Changing original user name, directories and computer name

Asked by Eglaelin

Heya,

I recently installed Ubuntu Fiesty Fawn. I have decided I do not like the original sign on name and computer name. I tried modifying the user name in account management. It created problems because it did not affect the directories and files that were created and therefore things won't open correctly.

What I want to do is:
1. Change the original user name while keeping password and modifying folders.
2. Change the name used for the computer.
3. Keep access to original account setup otherwise.

Thank you,
Eglaelin

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Lars Friedrichs
Solved:
Last query:
Last reply:
Revision history for this message
Lars Friedrichs (l-friedrichs) said :
#1

Hi,

2 is pretty easy, open system->administration->network, select the second tab and change the computer's name.
1 is quite unusual because it is very uncommon to change the user's name and even more unusual to change the home directory. Since programs may store the full path to certain files these programs don't work any longer if you change the home directory. What you can do is the following: (be careful, manual editing of system files requires caution, always a backup and a recovery cd in reach)
Let's pretend your old username is "old", the new one should be "new".

open a terminal window
type

sudo cp /etc/passwd /etc/passwd.backup
   (we do a backup first)
sudo gedit /etc/passwd

look for a line starting with "old:..."
change every "old" to "new" in that line - should be in two places: the username left and the home directory on the right.
save the file.

sudo mv /home/old /home/new
   (now the directory has the new name)
sudo ln -s /home/new /home/old
   (we do this so programs may look at the old name or at the new name by creating a symbolic link that points to the new directory and is named like the old dir.)

Normally the last step should not be needed but we try to play safe here.

Bye
Lars

Revision history for this message
Best Lars Friedrichs (l-friedrichs) said :
#2

Of course, don't forget to log out and in again...

Revision history for this message
Eglaelin (eglaelin) said :
#3

Thanks Lars Friedrichs, that solved my question.