How do I change the password in UNIX? In Unix operating system, how do I change my password?
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.
UNIX Task: Change Any Users Password
Login as the root user and type the command:
# passwd userName
# passwd vivek
# passwd tom
Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
UNIX Task: Change Your Own Password
Simply type the passwd command:
(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:
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 5 passwd
man 5 shadow