How to rename or change user name in Linux

by
Share this Article: Facebook0Google+15Twitter22LinkedIn1Reddit0StumbleUpon0

Question : How  to  rename or  change user name in Linux?

Answer:

killall -u old
id old
usermod -l new old
groupmod -n new old
usermod -d /home/new -m new
usermod -c “New Real Name” new
id new

Example:

kill -u pirat9
 #id pirat9
uid=1000(pirat9) gid=1000(pirat9) groups=1000(pirat9),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),109(lpadmin),127(sambashare)
# id blanco
uid=1001(blanco) gid=1001(blanco) groups=1001(blanco)
pirat9@pirat9 ~ $
usermod -l  blanco pirat9
groupmod -n blanco pirat9
usermod -d /home/blanco -m  blanco
usermod -c "James Bond" blanco
id blanco

Done

For questions please refer to our Q/A forum at : http://ask.unixmen.com/


Share this Article: Facebook0Google+15Twitter22LinkedIn1Reddit0StumbleUpon0