Useradd stores passwords in plain text?

Hey everyone! I’m pretty new to Linux, so I’m sure the answer is pretty obvious, but When I was making new accounts for a school activity, I noticed that all of the passwords were being stored in plain text in /etc/shadow. I was using useradd -p -g , but I was under the impression that useradd encrypts passwords. Thanks!

Just a quick chime in here but, my /etc/shadow seems to be locked to normal users and sudo cat /etc/shadow shows encrypted passwords.


The passwords as they can be seen in /etc/shadow are useless as is - and the file can only be read using elevated permissions.

➜  ~ ls -l /etc/shadow
-rw------- 1 root root 1032 26 jan 06:45 /etc/shadow

useradd does not encrypt passwords - instead they are salted and hashed using using SHA512 - which means the original password is not stored anywhere on the system - it only exist in your memory.

As such guessing the password using brute force is next to impossible.


Ok that makes sense. I didn’t think of the read permissions. Silly me! I just thought it was odd that a sudo cat /etc/shadow lists passwords created with useradd as plain text

edit: passwords created with passwd show up salted

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.