How to change username?

QuestionsQuestions8 SkillsProYour First Linux LabAug, 06 2025
0282

To change a username in a Unix-like operating system, you can use the usermod command. Here’s how to do it:

  1. Open the terminal.

  2. Run the following command (replace old_username with the current username and new_username with the desired new username):

    sudo usermod -l new_username old_username
  3. Change the home directory name (if you want to change it as well):

    sudo usermod -d /home/new_username -m new_username
  4. Update any references to the old username in system files or configurations as needed.

  5. Log out and log back in to see the changes take effect.

Note: Changing a username can affect file permissions and ownership, so proceed with caution. Always back up important data before making such changes.

If you need further assistance, feel free to ask!

0 Comments

no data
Be the first to share your comment!