1. Add user
Command: sudo useradd -m username -s /bin/bash
Interpretation: Create a username user who can log in, and use /bin /bash as shell
2. Set initial password or change password
Command: sudo passwd username
Interpretation: After executing the command, the interface waiting for password input will appear.
3. Add user as administrator
Command: sudo adduser username sudo
4. DeleteUser
Command: sudo deluser username
Interpretation: Delete user
Command: sudo userdel -r username
Interpretation: Delete the user and all related content of this user
5. View the host name
Command: hostname or uname –n
Interpretation: The host name can also be seen in the command prompt , the host name is usually located after the "@" symbol
##6. Temporarily modify the host name
Command: hostname newhostnameInterpretation: In this way, the new host name is not saved in the system , the host name will be restored to the original host name after the system is restarted; the effective host name will not be displayed immediately under the terminal. Only by reopening a terminal window (the terminal connected through ssh needs to be reconnected)
7. Permanently modify the host name
In the Ubuntu system, the host name is stored in the /etc/hostname file. Edit the hostname file, enter the new host name in the file and save the file
8. The difference between /etc/hostname and /etc/hosts
/etc/hostname stores the host name/etc /hosts is a file that configures IP addresses and their corresponding host names. Here you can record the IP addresses of the local machine or other hosts and their corresponding host names
##
The above is the detailed content of Detailed introduction to Ubuntu system username, password, and hostname management. For more information, please follow other related articles on the PHP Chinese website!