passwd command
LINUX-Frequently used commands
passwd command Set or change your password. |
Syntax |
passwd [User-name] |
The passwd command is used to set and change the password for login. A normal user can only change their own password, but a superuser (root) can set and change can set and change passwords for all users. You can set or change your password by running the passwd command with the username you want to change as an argument. and change it. General users and superusers who wish to change their own password do not need to specify a user name. |
Example: If you are a regular user (koro) and want to change your password. |
$ passwd Changing password for user koro. Changing password for koro (current) UNIX password: ← Enter current password New password: ← Enter new password Retype new password: ← Enter new password again passwd: all authentication tokens updated successfully. ← Successful password change message displayed |
Example: Change password as root. |
$ su - ← Become root Password: Enter root password # passwd koro ← Run the passwd command with the username (koro) Changing password for user koro. New password: ← Enter new password Retype new password: ← Enter new password again passwd: all authentication tokens updated successfully. ← Successful password change message displayed |