Sometimes we need to alter a user account name. For this task we need to use the usermod command.
The usermod command modifies the system account files to reflect the changes that are specified on the command line.
The syntax to change a user account name is as follows:
usermod -l
Example
-we will alter the user "adrian.oprea" to "adrian", so the account will maintain is privileges.
Note:
in case the user has sudo access you will need ot alter the sudores file to reflect the new user account name.
Next step is altering the users group name:
in our case the user group name is the same as the user name:
To alter the group name use the groupmod command with the -n option
And finally you need to change the home directory name:
The last step needed to be done is the restart of the /etc/init.d/autofs deamon
The /etc/init.d/autofs deamon is responsible for the mount points on the system, and their corresponding configuration files or network sources known as automount maps.