YouTube Icon

Code Playground.

How to Change User Password in Linux

CFG

How to Change User Password in Linux

In this guide we'll disclose how to change a client secret key in Linux. We will likewise tell you the best way to drive clients to change their secret phrase whenever they sign in. 

The directions should chip away at any Linux appropriation, including Ubuntu, Debian, and CentOS. 

Introduction

In Linux, you can change the secret word of a client account with the passwd utility. 

The encoded clients' passwords, just as different passwords related data, are put away in the/and so forth/shadow document. 

As a standard client, you can just change your own secret key. The root client and clients with sudo advantages can change another client's passwords and characterize how the secret word can be utilized or changed. 

While changing the secret key, ensure you're utilizing a solid and remarkable secret phrase. 

Having a solid secret phrase is the main thing you can do to make sure about your record. Regularly a solid secret phrase has at any rate 16 characters and contains in any event one capitalized letter, one lowercase letter, one number, and one unique character. 

For security reasons, it is prescribed to refresh your secret phrase consistently and utilize a remarkable secret key for each record. 

Change Your User Password

To change your own client's record secret phrase, run the passwd order with no contentions: 

passwd

linux change client secret phrase 

You will be provoked to enter your present secret phrase. In the event that the secret key is right, the order will request that you enter and affirm the new secret key. 

Passwords are not appeared on the screen when you enter them. 

Whenever you sign in to your framework, utilize the new secret word. 

Change Another User’s Password

As we referenced in the presentation, just the root client and clients with sudo access can change the secret word of another client account. 

The accompanying model expects that you are signed in as a client with sudo advantages. 

To change the secret phrase of another client account, run the passwd order, trailed by the username. For instance, to change the secret word of a client named linuxize, run the accompanying order: 

sudo passwd linuxize

You will be incited to enter and affirm the new secret word: 

Enter new UNIX password:
Retype new UNIX password:

On progress, the order will print something like this: 

passwd: password updated successfully

Force User to Change Password at Next Login

Naturally, passwords are set to never lapse. To compel a client to change their secret word whenever they sign in, utilize the passwd order with - terminate alternative followed by the username of the client: 

sudo passwd --expire linuxize

The order above will promptly terminate the client secret phrase. 

Whenever the client attempts to login with the old secret phrase, they will be indicated a message driving them to change the secret key: 

ssh linuxize@192.168.121.209
WARNING: Your password has expired.
You must change your password now and login again!
Changing password for linuxize.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Connection to 192.168.121.209 closed.

When the client sets another secret key, the association will be shut. 

Conclusion

In this instructional exercise, you have figured out how to change client's passwords and how to set secret word expiry. 

You can discover more data about the passwd order, by composing man passwd in your terminal or visiting the Linux passwd man page. 

In the event that you have any inquiries or input, don't hesitate to leave a remark.




CFG