en
  English
Phone :  +370 (5) 204-1903
Email: sales@1gbits.com

How to Change Password Linux

The passwd utility in Linux helps you to reset the password settings for a user profile. The /etc/shadow file stores encrypted passwords of the users and other details related to the password. As a regular person, you can change your password. The root user and users with sudo privileges can change other members' passwords and decide if they should be used or changed. Make sure you use a clear and special password when changing your password.

Linux Tutorial Jun 14, 21 by Nisal N 3 min Read
How to Change Password Linux

The passwd utility in Linux helps you to reset the password settings for a user profile. The /etc/shadow file stores encrypted passwords of the users and other details related to the password. As a regular person, you can change your password. The root user and users with sudo privileges can change other members' passwords and decide if they should be used or changed. Make sure you use a clear and special password when changing your password.

Using a secure password is by far the most crucial thing you can do to safeguard your account. When creating a password, it should contain at least:

  • an uppercase letter
  • a lowercase letter
  • an integer
  • a special character
  • at least sixteen characters

It is recommended that you change your password daily and use a different password for each account's security purposes.

How to Change Password Linux

We will describe two different procedure to change password in Linux

How to Change User Account Passwords

Execute the passwd command without any arguments or parenthesis to change the password of your user account:

passwd

Your existing password would be required to be entered. If the password is correct, the command will tell you to create a new user password and validate the password. While entering your password, it is not shown on the window. Use the same password in your future login sessions.

How to Change Password of Another User on System

Only the system administrator and administrators with sudo privileges can change the password to every other user account.

The following explanation assumes you have sudo rights and are logging in as that account.

Execute the command passwd, followed by the system username, to modify the password of the different user account. To modify the password of a user named urn, for example, execute the given command below:

sudo passwd urn

You'll be prompted to enter and validate your new password. If the command is executed successfully, it will print the following line:

passwd: password updated successfully

Modification by Force

By default, credentials are configured never to expire. To encourage the individual to change their password the next time they start a login session, use the passwd command with the --expire option accompanied by the person's username:

sudo passwd --expire urn

If you use the command above, the user password will subsequently expire.

The user will be prompted to update their password the next time they want to log in using their old password:

ssh urn@192.168.122.310

WARNING: Your password has been expiring.

You must now change your password and re-login!

For urn, you will be modifying the password. After the user has set a new password, the interface will be disabled.

Conclusion 

So this is how you can easily change account passwords and set password expiration. Changing passwords is very helpful for the admin or the root user to maintain the password conditions and send a notification once its password expiration date is exceeded. 

For further reading, I think you will like the following:

author img

Nisal N

Computers has always fascinated me since I was a kid and here we are. I love travelling for 2 reasons: the first one to see a new part of the world and second (the most important one) to experience the rich culture hidden among the country and people. I'm pretty good at cooking but very poor when it comes to baking.

Leave A Comment