How to change your username on Linux with the command-line. This is very easy indeed.

Posted: July 25, 2013. At: 7:47 PM. This was 4 years ago. Post ID: 6037
Page permalink:

To change the username of an already created account on a UNIX or Linux system just follow this simple guide.

I am changing the username mailman to mailman2. Firstly; open the /etc/shadow file with the VIM editor.

homer@deep-thought ~ % sudo vim.tiny /etc/shadow

Then find the entry you are after and edit the name and then press ESC and type :wq to save and quit the editor.


Then open the /etc/passwd file and change that value as well.

homer@deep-thought ~ % sudo vim.tiny /etc/passwd

Leave the /home folder value as is of course; but this will work very well to enable you to


After all of this you can use the /bin/login command to test whether the newly renamed account works or not. And it worked perfectly.

homer@deep-thought /home % sudo login                 
deep-thought login: mailman2
Last login: Thu Jul 25 19:37:06 EST 2013 on pts/0
Welcome to Linux Mint 15 Olivia (GNU/Linux 3.8.0-26-generic x86_64)
Welcome to Linux Mint
 * Documentation:
mailman2@deep-thought ~ $ pwd

No comments have been made. Use this form to start the conversation :)

Leave a Reply