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

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.

[email protected] ~ % 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.

mailman2:$6$T2nKWbz8$0O05diwqpTCRswkGFkMrFOsg0A5AvAvpuODT3hEiM7LYnuhNlJlgsSwCg1mS/EPi.8445D1o.qgvzf5tMVExD1:15911:0:99999:7:::

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

[email protected] ~ % sudo vim.tiny /etc/passwd

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

mailman2:x:1003:1003::/home/mailman:/bin/bash

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.

[email protected] /home % sudo login                 
deep-thought login: mailman2
Password: 
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:  http://www.linuxmint.com
[email protected] ~ $ pwd
/home/mailman

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

Leave a Reply