Skip to the content.

Create New User and Delete the Old One

To change the username on Ubuntu, you’ll need to create a new user with the desired username, give it the necessary permissions, and then optionally delete the old user. Here are the general steps:

1. Create a New User:

sudo adduser newusername

2. Add the New User to sudo Group:

sudo usermod -aG sudo newusername

3. Log Out:

4. Log In with the New User:

5. Optional: Change Home Directory Name:

sudo usermod -d /home/newusername -m newusername

6. Verify and Update Permissions:

sudo chown -R newusername:newusername /home/newusername

7. Optional: Delete the Old User (Backup First):

sudo deluser oldusername

This command removes the user but leaves the home directory untouched. If you want to remove the home directory as well, use:

sudo deluser --remove-home oldusername

Remember to replace “newusername” and “oldusername” with the actual new and old usernames.

After completing these steps, you should have successfully changed the username on Ubuntu. Keep in mind that changing usernames can have implications on file ownership and permissions, so make sure to check and update them accordingly.