Command To Change Password in Unix

Can you tell me command to change a password in Unix? How do I change a password in Unix operating system like macOS desktop or FreeBSD Unix server using the command line?

Introduction: To order to protect your Unix account, you must change your password at least every three to six months. A good password includes sequences of letters, numbers, and symbols that you enter to verify your identity to a Unix system. Once your identity verified, you will be granted access to server resources. In practice, one must use a password manager. A password manager can generate a password. It might be 30 to 40 characters long. It is far more difficult for a cracker to break a 40-character long password than an eight-character password. Apart from a good password on can use 2FA too to secure his/her password further.

Say hello to the Unix passwd command

All you have to do is type the following Unix passwd command to change your password:
You must provide an old password. Once old password verified, the Unix system will ask for a new password twice. As I suggested earlier, you must choose a complex password. All Unix password is case sensitive. The above command will change the password only on the laptop or server you are currently logged in using the ssh command or terminal session.

Command To Change Password in Unix

In short, to change your own password, type:
$ passwd
Command To Change Password in Unix
To change other users password, you must know root user password. A typical option is to use the su command or sudo command to become a root user and change the Unix user password:
$ sudo passwd
The file /etc/passwd contains a list of all users on Unix system. The passwd command contains other features, as well such as locking an user account and more.


In this quick tutorial you learned how to I change the password in Unix operating system using the passwd command. For more info see passwd command man page by typing the following command or online here and here:
$ man passwd

Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post

How to Make Website WCAG Compliant?

Next Post

Link download Kali Linux 2020.1 (ISO + Torrent)

Related Posts