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:
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
|Category||List of Unix and Linux commands|
|Firewall||CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04|
|Network Utilities||dig • host • ip • nmap|
|OpenVPN||CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04|
|Package Manager||apk • apt|
|Processes Management||bg • chroot • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time|
|Searching||grep • whereis • which|
|User Information||groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w|
|WireGuard VPN||CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04|