You can use the passwd command to change your password, and, as a system administrator, change the password of the root account, or another user in your Linux system. The syntax is as follows:
|Estimated completion time||Less than a minute|
passwd [option] userNameHere
Task: Linux Change Your Own Password
Login using the ssh client or open a command-line terminal (select Applications > Accessories > Terminal), than type the following command:
First, the user is prompted for their current password. If the current password is correctly typed, a new password is requested. The new password must be entered twice to avoid typing errors. Running passwd command with no arguments will allow you to change your own password.
Task: Linux Change root's User Password
To change root's password, you must first login as root user or use sudo / su command to obtain root's credentials. To become the root user, enter:
$ su -l
$ sudo -s
To change root's password, enter:
Task: Linux Change Another User's Password
To change the password of another user, login as root and type:
# passwd userNameHere
# passwd tom
# passwd jerry
A note about protecting your password
Your password unlocks your account and all data on Linux. So you need to protect your password. Here are some simple tips:
- Please do not write down your password. You need to memorize it.
- Do not use the same password for all your accounts including ssh, git, file and email servers. Use unrelated passwords for systems controlled by different organizations.
- Do not share or give your password, in particular to some one claiming to be from computer IT support department or a vendor.
- Make sure no one watch you enter your password.
- Change password periodically.
- Choose a hard-to-guess password. Avoid using the following passwords:
- Simple words or words that you'd find in a dictionary.
- Do not use your name including that of a spouse, child, pet, city and so on.
- Do not use your birhdate, ssn/pan, phone/mobile number and driving license numbers.
- A good password consists of:
- Mixture of upper and lower case letters, as well as digits or punctuation.
- At least 8 characters long.
- Passphrase : I love Pizza and Beer.
- Take the first letter of each word in a passphrase - I l P a B
- Add digits: I2 l P a9B
- Add special character: I2+l P&a9B
- Add other characters: qI2+lUP&a9Bw
Storing password securely
Use personal password manager to store all passwords in a securely encrypted file. I recommend:
- gpass application.
- See a list of 7 apps that works under OS X/Linux and MS-Windows to store passwords.
Anytime you need assistance with Linux passwd command-line, turn to the man page first. It will give you detailed information, parameters and switches for passwd command. For example, man passwd opens the man page for the passwd command:
$ man passwd
$ man 5 passwd
See alsoTwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!
- 30 Cool Open Source Software I Discovered in 2013
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012
- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop