Published Book on Amazon
All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 1 | |
All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 2 |
출판된 한글판 도서
최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (상) | |
최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (하) |
Original Book Contents
12.6.2 Changing User Password
12.6.2.1 Overview of Changing User Password
User password is the most basic means of keeping your system from external threats. Therefore, it is an important task of system management to give appropriate passwords and to manage them well.
The user password can be specified at the same time as the user account is created, or it can be specified after the user account is created. In addition, the existing password can be deleted or changed to another password.
12.6.2.2 "passwd" Command
To change the information associated with a user password, use the "passwd" command. Users logged on to the system can use this command to change their own passwords. The system administrator can also work on other user's passwords. You can use this command to grant a new password, to change or delete a previously granted password, or to adjust the expiration date.
[Command Format]
passwd [option] [logon user] |
[Command Overview]
■ This changes the password information of the specified user account
■ User privilege -- Normal user.
When you want to change your own password
-- Super user.
When you want to change another user's password
[Detail Description]
■ This command changes the password for the user account. A typical user can change the password only for their own account, but the super user can also change the password for all other accounts.
■ If you do not specify logon user, you will change the password for the user account that is logged on.
■ You need superuser privileges to change another user's password
[Main Option]
-d, --delete | Delete a user's password (make it empty). This is a quick way to disable a password for an account. It will set the named account passwordless. |
-e, --expire
| Immediately expire an account's password. This in effect can force a user to change his/her password at the user's next login. |
-i, --inactive INACTIVE
| This option is used to disable an account after the password has been expired for a number of days. After a user account has had an expired password for INACTIVE days, the user may no longer sign on to the account. |
-l, --lock
| Lock the password of the named account. This option disables a password by changing it to a value which matches no possible encrypted value (it adds a ´!´ at the beginning of the password).
Note that this does not disable the account. The user may still be able to login using another authentication token (e.g. an SSH key). To disable the account, administrators should use usermod --expiredate 1 (this set the account's expire date to Jan 2, 1970).
Users with a locked password are not allowed to change their password. |
-S, --status
| Display account status information. The status information consists of 7 fields. The first field is the user's login name. The second field indicates if the user account has a locked password (L), has no password (NP), or has a usable password (P). The third field gives the date of the last password change. The next four fields are the minimum age, maximum age, warning period, and inactivity period for the password. These ages are expressed in days. |
-u, --unlock
| Unlock the password of the named account. This option re-enables a password by changing the password back to its previous value (to the value before using the -l option). |
[Files]
/etc/passwd | User account information. |
/etc/shadow | Secure user account information. |
/etc/pam.d/passwd | PAM configuration for passwd. |
[Used Example]
If the logged-on user account wants to change his own password, do the following task. If you execute the command on the Terminal screen, task to chang the password is started.
pi@raspberrypi ~ $ passwd |
Changing password for pi. (current) UNIX password: Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully |
First, the message to confirm the current password for that user will be prompted. When you enter the correct password and press the [Enter] button, work to enter the new password will begin. Enter the new password for user "pi" and press the [Enter] button. You will then be asked to re-enter your password to verify your password. If you re-enter the password and press [Enter], the password change is completed. When the operation is completed, a message appears indicating that the password change has been completed.
12.6.2.3 Changing Password for System Default User "pi"
The "pi" user is a user who is basically provided to the system for system management and who is used to install and manage the system. As mentioned earlier, the "pi" user, which is provided by default on the system, has a initial password of "raspberry" and this password should be change when system installation is complete.
To change the password of "pi" user, you can use "raspi-config" command, which is a configuration tool for system booting entry. For more information, Please refer to the description of [9.4 Changing Password for Default User "pi"].