Linux User-related commands
PasswdCommand
For the sake of system security, in Linux, each user has a user name and password. Therefore, when you use the useradd command to add a new user, you also need to use the passwd command to set a password for each new user. Later, you can use the passwd command to change your password at any time.
The common format of this command is passwd [user name]. The user name is the user name that needs to change the password. Only super users can use "passwd User Name" to modify passwords of other users. Common users can only use passwd commands without parameters to modify their own passwords.
The command is used as follows:
Input
Passwd <enter>;
Enter the current password under (current) UNIX passwd:
Enter a new password at the prompt (this password is not displayed on the screen ):
The system prompts you to enter the new password again.
After the password is entered correctly, the new password is encrypted and put into the/etc/shdow file. It is important to select a password that is not easily deciphered.
The password selection rules are as follows:
The password should contain at least six (preferably eight) characters;
Passwords should contain uppercase/lowercase letters, punctuation marks, and numbers.
The process for a superuser to modify the password of another user (xxq) is as follows,
# Passwd Root
New UNIX password:
Retype new Unix Password:
Passwd: All authentication tokens updated successfully
#
SuCommand
This command is very important. It allows a common user to have the permissions of a Super User or other users, and allows the super user to do something as a normal user. A common user must have a superuser or another user's password when using this command. To exit the identity of the current user, you can exit.
The command is generally in the format of Su [Option] [? ] [User Account]
NOTE: If no user account is specified, the default value is Super User Root. The meanings of the options in this command are as follows:
? C. It will end after executing a command.
? The purpose of adding this minus sign is to make the environment variable the same as the user who wants to convert.
? M retains the environment variables unchanged.
Password: [enter the superuser password]