Wednesday, June 30, 2010

Change initial username on ubuntu server

Here i will explain how to change initial username of a user on ubuntu via CLI(Command Line Interface).

To change only username the command is :
#usermod -l newusername -m oldusername

To change username and home directory the command is:
#usermod -l newusername -d /home/newhomedir -m oldusername

Remember before you change the home directory please make sure that the newhomedir is exist or created

Don't forget to also change the group of the user you changes
#groupmod -n newgroupname oldgroupname

Usually groupname is same as username

Hope that help

Regards