Linux: Renaming Users in a Snap

Posted by Grego on December 20, 2016

Change Just the User Name

To change a user’s login name you can use the following command:

usermod -l new_username old_username

Change User Name and Home Directory

To also conveniently rename their home directory:

usermod -l new_username -m -d /home/new_username old_username

Change the Group Associated With User

To change the group name that gets associated with the user (you’d probably want to do this whether or not you change the home directory) use the following:

groupmod -n new_username old_username

References

StackOverflow - How can I rename an unix user?