passwd: Change the password for the current user
August 9th, 2024 1:18 PM Mr. Q Categories: Command
Command: passwd
The passwd
command allows users to change their own password or the password of another user if run with appropriate privileges. When changing your own password, you will be prompted to enter your current password and then the new password.
Sample Commands and Outputs:
passwd
: Changes the password for the current user. Sample Command and Output:
$ passwd
Changing password for user1.
Current password:
New password:
Retype new password:
passwd: password updated successfully
Description:
Changing password for user1.
: Indicates that you are changing the password for the current user.Current password:
: Prompt for the current password.New password:
: Prompt for the new password.Retype new password:
: Prompt to re-enter the new password for confirmation.passwd: password updated successfully
: Confirmation that the password was changed successfully.passwd username
: Changes the password for a specific user (requires root privileges). Sample Command and Output:
$ sudo passwd user2
Changing password for user2.
New password:
Retype new password:
passwd: password updated successfully
Description:
sudo passwd user2
: Changes the password foruser2
. Requires superuser privileges.New password:
: Prompt for the new password foruser2
.Retype new password:
: Prompt to re-enter the new password for confirmation.passwd: password updated successfully
: Confirmation thatuser2
‘s password was changed successfully.
Note: The passwd
command is a fundamental security tool for managing user authentication and should be used carefully to ensure that strong, secure passwords are set.