Introduction – To modify a user’s password or your own password in UNIX-like oeprating system use the passwd command command. To safeguard your Unix user/root password, you should change your password regularly.
How to change the password in UNIX
The procedure for changing the password of root or any user is as follows:
- First, log in to the UNIX server using ssh or console
- Open a shell prompt and type the passwd command to change root or any user’s password in UNIX
- The actual command to change the password for root user on UNIX is sudo passwd root
- To change your own password on Unix run passwd
How to change the Password in UNIX
Open the terminal and then type the passwd command entering the new password, the characters entered do not display on screen, in order to avoid the password being seen by a passer-by. The passwd command prompts for the new password twice in order to detect any typing errors. The encrypted password is stored in /etc/shadow file.
In Unix, how do I change my password
UNIX Task: Change Any Users Password
Login as the root user and type the command:
# passwd userName
# passwd vivek
# passwd tom
Sample outputs:
Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
UNIX Task: Change Your Own Password
Simply type the passwd command:
$ passwd
Sample outputs:
(current) UNIX password: Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
UNIX Task: Change root User Password
Log in as root user and run:
# passwd
Conclusion
The passwd command changes the user’s password. If no user is specified, the user’s login name is used. For more information see the passwd command man page by typing the following passwd command:
man passwd
man 5 passwd
man 5 shadow
🐧 2 comments so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • 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 • cron • 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 | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
Thanks…very useful
really thank you man