Ubuntu: Rename an Account [ User ID ]

To rename an account in Ubuntu, you can use the usermod command. The usermod command allows you to modify the properties of a user account, including the username.

Here’s how to rename an account in Ubuntu:

  1. Open a terminal window.
  2. Type the following command to rename the account, replacing “old_username” with the current username and “new_username” with the desired username:
sudo usermod -l new_username old_username
  1. If you also want to change the name of the home directory for the user, you can use the following command:
sudo usermod -d /home/new_username -m new_username
  1. After renaming the account and home directory, you may need to update the ownership of any files and directories in the home directory. You can do this using the following command, replacing “new_username” with the desired username:
sudo chown -R new_username:new_username /home/new_username
  1. Finally, log out and log back in with the new username to complete the account rename process.

Note that renaming an account in this way can have unintended consequences, such as breaking file ownership and permissions, or breaking references to the old username in configuration files and scripts. Be sure to thoroughly test any changes you make to ensure that everything works as expected.

Leave a Comment