Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

How do I change my logname?For e.g: xyz@ubuntu in the terminal how do I change xyz? I have tried this command

usermod -l *newname* -d /home/*newname* -m *oldname*

but that gave me an error user xyz is currently used by process PID

Command line solutions are appreciated.

share|improve this question

marked as duplicate by Aditya, Luis Alvarado Dec 9 '13 at 0:40

This question was marked as an exact duplicate of an existing question.

You cannot create a user with the same name as an existing user - you can list the all of current users with cat /etc/passwd. – Wilf Dec 8 '13 at 15:04
you want to remove the "hostname". Ex. braiam@braiam-pc becomes braiam? – Braiam Dec 8 '13 at 15:08
user wants to change xyz in xyz@ubuntu, @Braiam. It might also be simpler to create a new user with useradd <newname>, and move the user home directory with mv /home/<oldname> /home/<newname>, though it might not work due to user specific files. – Wilf Dec 8 '13 at 15:10
up vote 0 down vote accepted

You need to not be logged in as the user whose name you are trying to change, while running the usermod command to change the user name. You will have to log out, log in as a different user (such as root), and run the command without your standard user being logged in.

share|improve this answer

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