The username in Linux is a fundamental part of each task since without a user it would be impossible to access the computer, be it a normal user, a user with administrative permissions or even the root user himself, hence the importance of the user in Linux . Having differentiated users when different people use the same computer is important to separate information, even if the same person uses the PC in different ways..
To have a well-managed team, having users configured correctly helps us to be able to use it effectively. In Ubuntu 20.04, 20.10 or Ubuntu 21.04 it is possible to change the username from the terminal and getFastAnswer will explain how to do it in a simple way using commands.
To stay up to date, remember to subscribe to our YouTube channel! SUBSCRIBE
How to change username in Ubuntu with terminal
Step 1
First, we create the new user using the following syntax:
sudo adduser "user"
Step 2
When pressing Enter we enter the password to assign and some data that can be omitted with the Enter key:
Step 3
Once the user is created, we are going to add it to the sudo group with the following command:
sudo adduser "user" sudo
Step 4
Now we set the password of the root user with the following command:
sudo paswd root
Step 5
We reboot the Ubuntu system:
Step 6
In the login screen we can see the new user created:
Step 7
We log in with this new user:
Step 8
In the system we open the terminal and access as root:
su root
Step 9
Then we execute the following:
usermod -l "new name" -d / home / "new path" -m "new name"
Step 10
Now we execute the following:
passwd -l root
Step 11
Again we restart the system and this time we access with the original user:
Step 12
In the terminal we delete the created user:
sudo deluser "user"
Step 13
Now we delete your profile. This allows the new assigned name to be preserved.
sudo rm -r / home / ”user”
With these steps we can change the username in Ubuntu..