Add user
The operation of adding a user in ubuntu is as follows:
sudo adduser test
It will automatically create a group with the same name, create /home/test/, copy files from etc/skel/, and set a password and related initial identity information
delete users
The ubuntu delete user operation is as follows:
sudo userdel test
cd /home/
sudo rm -r test
ubuntu modify user name
Enter Ubuntu, open the terminal, enter sudo su to migrate to the root user. Note that you must migrate to the root user first.
ubuntu modify the user name user to robot, please modify in order
1. Modify the sudoer file
sudo gedit /etc/sudoers
2. Modify the shadow file
The format of the login-related content stored in this file is as follows:
username: passwd: lastchg: min: max: warn: inactive: expire: flag
Login Name: Encrypted Password: Last Modified Time: Min Interval: Max Interval: Warning Time: Inactive Time: Expiration Time: Flag
sudo gedit /etc/shadow
Modify the login name
3, modify the start directory
cd /home/
sudo mv test robot
4. Modify the password file
sudo gedit /etc/passwd
In /etc/passwd, find which line after the original user name, you need to modify three fields
5. Modify the user group
If you need to modify the user group, change the user in /etc/group to robot.
Your user name should be found in many groups and must be modified! ! ! !
6. Finally, enter the /etc/sudoer file again and delete the username user
7. Restart, log in again, the user name is changed successfully
ubuntu modify the host name
1. Modify the hostname file
and change it to robot-home
sudo gedit /etc/hostname
2. Modify the hosts file
sudo gedit /etc/hosts
3. Restart, log in again, and the host name is successfully modified
ubuntu change password
[Tip] When changing the password and user name, please change the password first, restart, then change the user name, and restart. If you change your password after changing your username, you may not be able to log into Ubuntu. 】