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 check user's password and change password in Linux system

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article will explain in detail how to view user passwords and modify passwords on Linux systems. The content of the article is of high quality. Therefore, Xiaobian shares it with you as a reference. I hope that after reading this article, you will have a certain understanding of relevant knowledge.

Linux system is a multi-user system, so there are many different accounts stored in the system, but some friends with poor memory will forget the account password, resulting in unable to log in to the Linux system, so what should I do?

First of all, we need to know that on linux systems, user names are stored in/etc/passwd; passwords are stored in/etc/shadow. Knowing these two important pieces of information would make things much simpler.

If we want to see a user's password, we have to log in as a super user to see it:

su root

Then enter the login password of the super user, and then we need to check the password of the corresponding user in/etc/shadow:

cat /etc/shadow |grep * #Note that the * here is the user name, that is, which user name needs to be checked, here it is replaced with the user name.

Take my example here (I removed my username and password ciphertext):

We can see a string of characters coming out, obviously not the password we used at the beginning. What's going on? This is because the system encrypts our plaintext password for security. Since it's encrypted, we need to decrypt it. To decrypt it, we need to know what encryption our system uses. We enter the following command:

authconfig –test | grep hashing

As you can see, the password encryption method I show here is MD5, which is easy to handle. We can go back to the previous problem. We only need to decrypt our ciphertext password MD5 to get our actual password.

Let's go back to the string. Here, we have a certain interpretation of the string just now.

(Let's take a string of characters as an example)

xxx:Bg1H/4mz$X89TqH7tpi9dX1B9j5YsF.: 17969:0:99999:7::: The format of the above string is (everyone interested friends can do more information, we just need to find our ciphertext password):

{User name}:{Password after encryption}:{Days between the last password modification time and the origin (1970-1-1)}:{Minimum password modification interval (to prevent password modification, if the time limit is not up, it will revert to the old password):{Maximum password modification interval}:{Warning days before password expiration}:{Account inactivity days}:{Account expiration days}:{Reserved}

[Note]: Shadow files are readable files, ordinary users do not have read and write permissions, and super users have read and write permissions. If the password string is *, it means that the system user cannot be logged in; if the string is!, The username is disabled; if the string is empty, there is no password.

We can use passwd-d username to clear a user's password.

So we know that in the string above,"xxx" is the username,"Bg1H/4mz$X89TqH7tpi9dX1B9j5YsF. "is a cipher.

All right, now that we have the ciphertext password, we can use it for MD5 decryption.

Linux versions are: Deepin, UbuntuKylin, Manjaro, LinuxMint, Ubuntu and other versions. Deepin is one of the best Linux distributions in China; Ubuntu Kylin is a derivative distribution based on Ubuntu;Manjaro is a Linux distribution based on Arch;LinuxMint's default Cinnamon desktop is similar to Windows XP and easy to use;Ubuntu is a Linux operating system based on desktop applications.

About Linux system how to view user passwords and modify passwords to share here, I hope the above content can be of some help to everyone, you can learn more knowledge. If you think the article is good, you can share it so that more people can see it.

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

Development

Wechat

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

12
Report