Ask your questions here.
Post a reply

Refracta installer create new user

Mon Aug 12, 2013 6:34 pm

Hi,
I have some feedback that it is not possible to create a new user with refracainstaller.
Any tips most welcome my friend.

Re: Refracta installer create new user

Tue Aug 13, 2013 9:43 am

The text-only script does not allow you to change the user name, but the gui script does. If you use the cli script, you can reboot into the newly-installed system and run 'change-username' to change the primary user's account. If the installer completes successfully, the last screen says
Done! You may now reboot into the new system.
If you want to change the user name, then run
change-username after reboot.
.

Code:
change-username    <oldname>    <newname>

Re: Refracta installer create new user

Tue Aug 13, 2013 11:21 am

Perfect!
Thanks so much...I will give this a try.
You are very helpful.

Re: Refracta installer create new user

Wed Aug 14, 2013 3:07 pm

I have tried the above but in tty I get this error upon trying change-username;

usermod: user live is currently used by process 2504
Exit due to error; 1

Re: Refracta installer create new user

Wed Aug 14, 2013 5:29 pm

log in as root without login in as user.
if any display manager is running (gdm, slim, kdm, ligthdm, xdm) stop it with "service name-of stop" from tty

Fool with ps to figure out which processes are run by the user named "user" (something like "ps -auuser" -that is ps -au + username instead of x - or "ps aux | grep user" or whatever). If it makes sense kill them "ps kill <process-id>" or "ps kill -9 <process-id>. All that process stuff is beyond me, it's workarounds, aka dirty solutions.
Only in case the above doesn't work, and only to troubleshoot.

Re: Refracta installer create new user

Wed Aug 14, 2013 5:38 pm

Oh, and i usually just stick to the default user called user. That is an option too.
Or just rsync the hidden files to the new user:
rsync -auv /home/user/.[a-zA-Z0-9]* /home/new-user-name/
but then you will have to grep for the old user name in some directories (for sure in .config) and replace them. There is a snippet of code, bad news: somewhere, but sure in the script change-username too, how to do that in one command. You will perhaps need .[a-zA-Z0-9] or an option for grep to use the hidden files too. http://stackoverflow.com/questions/1037 ... dden-files

Re: Refracta installer create new user

Wed Aug 14, 2013 6:02 pm

@nadir
Thanks.
Log in as root was required.

It would be great if this process was included in refracta installer 8-)

Re: Refracta installer create new user

Thu Aug 15, 2013 3:15 am

Here's the code to find the user's old name in the config files:
Code:
grep -r "/home/$oldname" /home/$newname/.config | awk -F":" ' { print $1 }'


And here it is from the change-username script:
Code:
for i in $(grep -r "/home/$oldname" /home/$newname/.config | awk -F":" ' { print $1 }'); do
    sed -i "s/\/home\/$oldname/\/home\/$newname/g" "$i"
done


An undocumented feature of the change-username script is that you can use it to change any user's name. The gui installer will only change the primary user's name (the one with uid and gid 1000).

Another approach is to delete the user and /home/user and just create a new one. You'd lose all the desktop configurations, but if you're not using a desktop, that shouldn't matter.
Post a reply