Faster Learning Tutorials

Linux passwd command summary with examples

passwd allows you to change user passwords.
  1. Purpose - Learn what passwd is for and how to find help.
  2. Options - Review a few common options and arguments.
  3. Examples - Walk through code examples with passwd.
  4. A tip - Finish off with one more insight.
Paul Alan Davis, CFA, November 10, 2016
Updated: August 5, 2018
In this tutorial, 80 of 100, below find a 3-4 minute introductory video, a text-based tutorial and all of the code examples from the video.

Outline Back Next

~/ home  / tech  / linux essentials  / passwd command

The Linux passwd command


Learn to change user passwords at the Linux command line.

Video Tutorial

Linux passwd command summary with examples (3:45)

Videos can also be accessed from the YouTube Playlist.

Video Script

The Command and Why You Need It

Our eightieth word, or command to memorize is passwd from our category Users.

passwd allows you to change user passwords.

Recall from recent videos (tutorials) on su and sudo we logged in as another user and temporarily became a superuser to perform administrative functions, and now we'll learn about passwords.

Before we start, it helps to think of commands as mini programs and most follow this structure: command -option(s) argument(s).

The passwd command has 15 options, and the argument is the login (name).

Like most commands, help is available with double-dash --help. Non-superusers can only change their own password by using passwd optionless and they are prompted for the old password and the new. The superuser changes passwords for others and can use -e to expire a password, or even -l to lock an account and -u to unlock it.

So why is passwd an important command? Well, everyone needs to understand policies on password resets, password complexity and frequency of changes. And now you know how to do that.


Okay, the best way to embed this in your memory is by typing in your own terminal window.

Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.

Here we go. Let's say it's Friday and Jennifer's password expired according to policy, and she's setting a new one. I've used the su command (from video 78) to pretend I'm her with the passwd Enter.

jennifer: $ passwd Changing password for jennifer. (current) UNIX password: Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully jennifer: $ _

Enter the current password and then the new one it will confirm twice.

Okay, hit exit to leave.

jennifer: $ exit $ _

And I'm no longer Jennifer now.

Now, fast forward to Monday and after a really good weekend Jennifer forgot her password. So as the administrator, I'll set up a new one using sudo passwd jennifer.

$ sudo passwd jennifer Enter new UNIX password: _ Retype new UNIX password: _ passwd: password updated successfully

Enter a new one, which I will supply to her.

And last, so she selects her own password, I'll run a sudo passwd -e jennifer.

$ sudo passwd -e jennifer passwd: password expiry information changed.

And when she logs in, she'll be required to change it. Okay, very good.

A Final Tip

Okay now you know how to use passwd. And you know the syntax for commands, options and arguments.

One last tip about the passwd command. So I recommend reading the man page here as it's a particularly easy one to grasp in only 5 minutes.

Okay, thanks for visiting today. I hope this was a helpful introduction to the passwd command.

Learn More About The Series

For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:

What's Next?

Here's one of those YouTube subscription buttons, in case you'd like to follow us there.

  • For the Outline to all 100 tutorials, click Outline.
  • To go back to the sudo command, hit Back.
  • To learn more on users and groups with the adduser command, click Next.

Outline Back Next

~/ home  / tech  / linux essentials  / passwd command

linux passwd command
etc passwd
linux change user password
sudo passwd
linux set user password
passwd file
man passwd
linux etc passwd
linux password file
linux change password
password administration
change password Linux
linux change password
expire password
lock user account
unlock user account
pwd linux