Unix Command To Change Password

In Unix and Linux systems, the passwd command is used to change a user’s password. The basic syntax is as follows:

 
passwd [options] [username]

If you’re changing your own password, you can simply run the command without specifying a username:

 
passwd

The system will prompt you for your current password and then for your new password, which you will need to enter twice to confirm.

If you’re changing another user’s password, you must be logged in as the root user or use sudo to run the command:

 
sudo passwd username

Replace username with the username of the user whose password you want to change.

Note that some systems may have different requirements or restrictions on password length, complexity, or expiration, so be sure to consult the documentation for your specific system for more information.

Leave a Comment