How to change password in Linux by using commands, Guide for Beginners

how-to-change-password-in-linux-terminal

Do you bore to enter the same password again and again? OR Someone knows your password and access your system in your absence.

Password is a key to protect your system from those, who are not authorized. If you want to protect Linux System or other systems, Change the password periodically.

Become habitual to change the password from time to time. When you change the password don’t forget about password policy.

I am telling you silently, Hacker can crack your Linux password easily. 2 minutes is enough to crack the password.

This post is not about how to crack password, It is about How to change password in Linux system.

Now I am coming on the point How to change password in Linux by the terminal without wasting more time.

Article Content

How to change password in Linux of current user [logged in User]

You can change the password by using simple command passwd. No matter which type of user you are a normal user, sudo user or root user.

You must know the password of the current user. The system will verify your authorization.

If you don’t know the current password means you are not an authorized, person.

Don’t try to change the password if not authorized. This comes under cybercrime. and it may send you Jail.

$passwd

It will ask for the current password, give it and enter the new password twice. Typing character and star will not display on the screen, but don’t worry type complete password whatever asked.

vijay@Ubuntu-19:~$passwd
Changing password for vijay.
Current password: 
New password: 
Retype new password: 
passwd: password updated successfully
vijay@Ubuntu-19:~$

Now you have changed the password successfully.

How to change password in Linux of another user

It is the next challenge for you to change the password of another user in Linux. So do you want to learn it? If yes read continue…

Either you must be a sudo user or root user, to change the password in Linux of other users.

If you are a sudo user then you must know the current password, if you are a root user no problem for the current password anymore.

Simple syntax

$sudo passwd username

vijay@Ubuntu-19:~$sudo passwd cyrage
[sudo] password for vijay: 
New password: 
Retype new password: 
passwd: password updated successfully
vijay@Ubuntu-19:~$

If you are confuse to see the available users you can check my old post about How to check list users in Linux

Force user to change password at next Login

You have been working as Linux Administrator and you find some suspicious activities by cyrage user.

So you can force cyrage user to change the password before doing anything. If he must know the current password to set a new password.

vijay@Ubuntu-19:~$sudo passwd --expire cyrage
[sudo] password for vijay: 
passwd: password expiry information changed.
vijay@Ubuntu-19:~$

You can see a demonstration below:

vijay@Ubuntu-19:~$su cyrage
Password: 
You are required to change your password immediately (administrator enforced)
Changing password for cyrage.
Current password: 
New password: 
Retype new password:
vijay@Ubuntu-19:/home/vijay$whoami
cyrage
vijay@Ubuntu-19:/home/vijay$

How to change password in Linux by GUI [Ubuntu 19.04]

Graphical User Interface (GUI) is a very loved interface by people. Most people don’t like using the terminal. So if you are one of them, Nevermind, You can change the user password in Linux by GUI.

Step#1 Go to Account Settings:

Click on the drop-down menu at Right-Top corner > Username > Account Settings.

33-open-account-settings

Step #2 Click on the password.

New windows will be pop-up after a click on account settings, Click on password area is displayed on the screen.

34-how-to-change-password-in-linux-using-Graphical-interface-GUI

Step #3 Change Password

Provide Current password and New password twice, then click on the change to proceed forward.

35-change-password-in-linux-ubuntu-19.04

If you like our content, please consider buying us a coffee.
Thank you for your support!

Leave a Reply

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