An important part of user management is the management of user passwords.
A user account is locked by the system and cannot be used without a password. It can be used only after a password is specified, even if it is a blank password.
The shell command used to specify and modify the user password is passwd. Super Users can specify passwords for themselves and other users. Common users can only modify their own passwords.
Command Format:
Code: passwd option User Name
Available options:
-L the password is disabled.
-U password unlock.
-D indicates that the account has no password.
-F forces the user to change the password upon next login.
If the default user name is used, modify the password of the current user.
For example, if the current user is Sam, the following command modifies the user's own password:
$Passwd
Old password:
******
New password:
*******
Re-enter new password:
*******
If you are a super user, you can specify the password of any user in the following form:
#Passwd Sam
New password:
*******
Re-enter new password:
*******
When a common user modifies his or her own password, the passwd command First asks for the original password and then asks the user to enter the new password twice. If the two passwords are the same, the original password is not required when the superuser specifies a password for the user.
For the sake of security, you should select a complicated password. It is best to use a password of no less than 8 digits. The password contains uppercase letters, lowercase letters, and numbers, it should be different from the name and birthday.
When you specify a blank password for a user, run the following command: Code: # passwd-d sam: This command deletes the password of the user Sam, so that the user Sam will log on to the next time, the system no longer asks for the password. The passwd command can also use the-l (LOCK) option to lock a user so that the user cannot log on. For example, code: # passwd-l Sam