To change a username in a Unix-like operating system, you can use the usermod command. Here’s how to do it:
-
Open the terminal.
-
Run the following command (replace
old_usernamewith the current username andnew_usernamewith the desired new username):sudo usermod -l new_username old_username -
Change the home directory name (if you want to change it as well):
sudo usermod -d /home/new_username -m new_username -
Update any references to the old username in system files or configurations as needed.
-
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!
