Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to change the account password in Linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

What this article shares to you is about how to change the account password in Linux. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article.

Change the password of a personal account

Ordinary users who want to change their personal account password simply run the passwd command without any other commands:

$passwd

Sample output:

Changing password for nick (current) UNIX password:Enter new UNIX password:Retype new UNIX password:passwd: password updated successfully

We will be prompted to enter the current password first and, if the password is correct, to re-enter and confirm the new password. The next time you log in to the Linux system, you can log in with the new password.

Note: when entering a password, the password will not be displayed on the screen.

Change another user's password

As an ordinary user, you can only change your own password. However, root users and users with sudo privileges can change the passwords of other users.

We need to log in as root, type the following command to change the password of user nick:

$passwd nick

Or use the sudo command

$sudo passwd nick

Output: you will be prompted to enter and confirm the new password

Enter new UNIX password:Retype new UNIX password:passwd: password updated successfully

Force the user to change the password the next time they log in

By default, the password is set to never expire. If you want to force the user to change their password the next time you log in, you need to use the command passwd with-- expireoption, followed by the user's user name, for example:

$sudo passwd-expire nick

This immediately causes the password of the user account to expire.

The next time a user tries to log in with the old password, a message will be displayed forcing them to change the password:

$ssh nick@192.168.121.209

Output:

WARNING: Your password has expired.You must change your password now and login changing password for nick. (current) UNIX password:Enter new UNIX password:Retype new UNIX password:passwd: password updated successfullyConnection to 192.168.121.209 closed. What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.

The above is how to change the account password in Linux. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report