Instructor: Changing password.
In this lesson, we will cover
how to change the user password.
Either you are root and you force the user
to change the password, or the first time you log in,
or if you are just yourself
and you want to change your own password.
You should change your initial password
as soon as you log in.
Now, this is when your account is created
for the first time in the system,
and you log in with the password that's been given to you.
Or sometimes what happens is,
password is not given to you.
You will just log in with your username,
and it will automatically prompt you
to change or put in a new password.
To change a passwd, the command is password
followed by the user ID.
And please remember, it's not the entire word
password as a command, it's just P-A-S-S-W-D.
It does not have O and R in it,
so it's passwd space user ID,
and the user ID in my case is iafzel.
When you hit Enter, it will ask you for your old password
or your existing password that you have.
You provide that password,
the next thing it will ask you
is to put in your new password.
You input your new password,
it will reconfirm the new password for you.
So it will ask you to retype your new password.
The reason they ask you for the second time is because,
if you have made a mistake in your earlier entry
adding the new password, it will match to confirm
that you have added the correct password.
Now, if you just type the password command
while you are root,
then, remember, it will change your root password.
If you type password followed by the user ID,
then it will change the password of that user.
So, just be very careful.
So let's log into our Linux machine through the console
and see how we could change the user password.
Here we have our Linux machine console,
we'll just do a right-click and open the terminal.
I always like to make this terminal a little bigger.
Make the window a little bigger,
I could just simply drag and drop
or I could simply maximize it by clicking here.
Anyway, let's get into our changing password procedure.
So, when I type password followed by my user ID,
it says only root can specify a username.
So, only root has the right to specify
the username or change another user's password.
I'm not root, I am myself.
Who am I, or who am I? Myself.
So, all I would do is just put in a password command,
not the username, and hit Enter.
And now it's asking me to change
or provide my current password.
So, I'm going to put in my current password,
now it's asking me for a new password.
Remember, I'm going to put in,
this time I'm just going to put in 1234.
And let's see what it says.
It says the password is shorter than eight characters,
so let's put in 12345678.
All right, and it says the password fails
the dictionary check.
So now, Unix, or Linux or most of the
operating systems nowadays have this check
where it looks for the dictionary
and sees if that password exists,
or see if that word exists or not.
So make sure you change the password to something
that does not go with the dictionary,
or does not have a sequence of characters.
So, I'm going to change it to something different.
There you go.
See, it took it.
I'm going to reconfirm it.
And passwd, all authentication tokens updated successfully.
Okay, so that's how you use the passwd command
to change your password.
I want you to try that command
a couple of times in different ways and see how it works.
Become root and change your password
by typing passwd iafzel or username,
and then log in as yourself and try that command.