Passwd vs Shadow

Skybear

Active Member
Joined
Mar 7, 2026
Messages
193
Reaction score
151
Credits
1,525
I’m learning about users and groups. The presenter just discussed the Passwd and Shadow commands.

I have two questions:
1) When using Passwd, why do I see only a placeholder (“x”) and not the actual password?
2) Has the use of Passwd changed? When I googled Passwd, the Geeks for Geeks website tells me that command will indeed change a user’s password. https://www.geeksforgeeks.org/linux-unix/passwd-command-in-linux-with-examples/
 


1. Do you mean password letters are not visible while typing? If yes, it's a simple security feature, stranger will not see your password by looking at your screen from behind your shoulder.
2. Check man passwd in the terminal to read how this command works.
 
I was getting confused between passwd, to change a password, and cat /etc/passwd, to view user details. I think I understand the difference now. One thing I did use was the man command.
 
Yes, there is also a man shadow, but notice it says "library call" at the top. The passwd command calls the shadow library to encrypt and save the password (in /etc/shadow). This is standard for Linux for a long time and nothing a user needs to worry about. One reason for the change, i.e. not including the password itself in /etc/passwd anymore, was the shadow system can separate and limit access to the passwords:

$ ls -la /etc/passwd /etc/shadow
-rw-r--r--. 1 root root 3063 Dec 16 16:58 /etc/passwd
----------. 1 root root 1409 May 7 08:18 /etc/shadow
 
2) Has the use of Passwd changed? When I googled Passwd, the Geeks for Geeks website tells me that command will indeed change a user’s password. https://www.geeksforgeeks.org/linux-unix/passwd-command-in-linux-with-examples/
passwd is cli tool to change password, however you should use your DE to change it because this will emit the change to other GUI tools that depend on it, such as various GUI keys managers, e.g. KWalletManager in KDE.
The cli tool won't affect GUI, it's only safe on servers with no GUI or systems without any UI tools that need your password.
 
To change your known Password...
1781530236616.png

Type your password...hit Enter...type new password...hit Enter...you'll see your password has been changed.
To change your password you forgot...that's a bit harder.
1781530479932.gif
 
To change your know Password...
View attachment 32309
Type your password...hit Enter...type new password...hit Enter...you'll see your password has been changed.
To change your password you forgot...that's a bit harder. View attachment 32310
You would have to login as root on a recovery startup mode in order to get there.
Then you can change it from there!
 
If you know the root password, you can change any user password by just using su. If you don't know any user or root password, you're just a random hacker.
 


Follow Linux.org

Members online


Latest posts

Top