Oh dear, okay, let's start at the very beginning...
We know that users' passwords are saved in /etc/passwd, but in an encrypted way
No, they have been stored in /etc/passwd
, and that was quite some time ago. Today passwords are stored in a so-called shadow file, most of the time /etc/shadow
.
but in an encrypted way, so even the root can't see them:
I know it's sometimes used interchangeably, but hashing is not encryption. Encryption is by its very definition reversible, meaning you can translate the encrypted thing back into its cleartext form. Hashing is designed to be not reversible in any way (except brute force). The original cleartext form of something that is hashed is not supposed to be recoverable.
Passwords in the shadow file are stored as hashes.
as shown above :x: represent the password
The x
in this case is only a placeholder for the legacy password field. The x
means that the password can be found in the shadow file.
Is there a way (possible configuration) to save the password in the /etc/passwd in clear text and such that the root can see them?
No, there isn't a way except changing many applications and the way they work.
But why is it not easily possible? Well, for a simple but very important reason: security. I suggest to read these questions:
But to sum it up, assume the following: There is a server in a company, all user accounts are secured by their passwords and the data in these user accounts is encrypted with the same password. A cracker from the outside gains access to the server, but they can't access any of the important data because that is still encrypted in the user accounts.
Now assume the passwords would be stored in plain text. The cracker would suddenly have access to everything, because the passwords can be read. But if they're stored as hashed values, they are close to useless to anyone except people with a lot of resources to do a brute-force attack.