I installed a fresh Ubuntu Gnome 14.04.3 today, but I just notice that I reversed the username and hostname during installation.

To illustrate this, when I open a terminal, the prompt looks like :

myhost@myname:~$

instead of

myname@myhost:~$

It is the unique user (so it is the normal admin).

How can I fix this problem ?

share|improve this question
    
If it's a fresh system, you may find more convenient to simply reinstall it with the right data. – Ángel Aug 9 '15 at 20:24
up vote 5 down vote accepted

To change the hostname

You need to edit the computer name in two files as root user:

/etc/hostname 

and

/etc/hosts

To change username (it is probably best to do this without being logged in):

usermod -l newUsername oldUsername

This however, doesn't rename the home folder.

To change home-folder, use

usermod -d /home/newHomeDir -m newUsername

after you changed the username.

For instance, you could logout, drop to a console (Ctrl+Alt+F1), and sudo su - to become true root (as opposed to sudo -s, where $HOME is still /home/yourname.) Maybe you also have to kill some still running processes from this user first. To do so, enter ps -u username, look for the matching PID and kill them by kill PID-number.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.