Change the Password in UNIX Command

To change the password in UNIX, you can use the passwd command in a terminal window.

To change your own password, simply type passwd and press Enter. You will be prompted to enter your current password, followed by your new password and a confirmation of your new password.

For example:

$ passwd
Changing password for user user1.
Old Password:
Enter new password:
Retype new password:
Password changed.

If you are logged in as the root user, you can use the passwd command to change the password for any other user on the system. For example, to change the password for the user user2, you would run the following command:

$ sudo passwd user2
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Note that the exact behavior of the passwd command may vary depending on the specific UNIX-based operating system you are using. For more information, you can refer to the manual page for the passwd command by typing man passwd in a terminal window.

Leave a Comment