An ad-free and cookie-free website.
Learn to change user passwords at the Linux command line.
Videos can also be accessed from the Linux Essentials Playlist on YouTube.
Linux passwd Command Summary with Examples (3:45)
Our eightieth word, or command to memorize is
passwd from our category
passwd allows you to change user
||Print help screen|
||Set an account's password to expire immediately|
||Lock the user account|
Recall from recent videos (tutorials) on
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).
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
-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
Enter the current password and then the new one it will confirm twice.
exit to leave.
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
sudo passwd jennifer.
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.
And when she logs in, she'll be required to change it. Okay, very good.
Okay now you know how to use
And you know the syntax for commands, options and arguments.
One last tip about the
command. So I recommend reading the
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
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:
I suggest using multiple modes of learning here. Check out the video while reading the text and key in the code. That's the fastest way to learn.
sudocommand, hit Back.
addusercommand, click Next.
A newly-updated free resource. Connect and refer a friend today.