Linux: Changing your password from the CLI

We all know that passwords are some of the most important pieces of information we have to remember, but on top of that we’re told we should change them regularly. This is all well and good, but do you know how to change your Linux password when you can’t get into the X windows manager? Or maybe you’re remotely connecting and don’t have the option to use a GUI. How do you change your Linux user password then?

Thankfully, its VERY simple… which is what we all like to hear.

When you’re logged in, simply run:

passwd

You’ll be prompted for the old and new password, but eventually you’ll be told the password has been updated.

Changing password for paul.
 (current) UNIX password:
 Enter new UNIX password:
 Retype new UNIX password:
 passwd: password updated successfully

This updates the users entry in the Linux shadow file, a place where all user passwords are stored securely.

Easy to remember Password Strength Strategy

Obviously I should point out that your password should be strong – use a combination of upper and lower case letters, and throw in at least one number randomly too. Adding special characters greatly increases the strength too, although not all system accept the same characters.

If you want to use places or names for passwords, follow a simple strategy like this one

  • Make sure the word is at least 6 characters long,
  • Capitalise the first character,
  • Replace letters, regardless of case, with numbers that look like them:
    • all O’s with zeros,
    • L’s with ones,
    • E’s with 3’s and
    • S’s with 5’s
  • Put the length of the word at the end, in digits, followed by an exclamation mark,

Using this strategy, the following simple to break passwords become much stronger:

  • holland becomes H011and8!
  • alexsfacebook becomes A13x5fac3b00k13!
  • myworkpassword becomes Myw0rkpa55w0rd14!

The best bit is you don’t have to remember the hard password, just holland or alexsfacebook for example, and the simple steps to convert it from easy insecure to hard and robust.

Hope this helps.

Leave a Reply

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