Can we know the password for the other users if we have root access

passwordrhelusers

If a person has root access to a particular RHEL machine, will they be able to retrieve the password of the other users?

Best Answer

TL;DR: No, password are stored as hashes which can (in general) not be recovered.

Linux doesn't store plain-text passwords anywhere by default. They are hashed or otherwise encrypted through a variety of algorithms. So, in general, no, this isn't possible with stored data.

If you have passwords stored somewhere other than the /etc/passwd database, they may be stored in a way that allows this. htpasswd files can contain wealy encrypted passwords, and other applications may store weaker hashes or plain text passwords for various (typically bad) reasons.

Also, user configuration files may contain unencrypted passwords or weakly protected passwords for various reasons - fetchmail grabbing content from another service, .netrc, or simple automated things may include the password.

If the passwords are hashed or encrypted with an older, weak algorithm (3DES, MD5) it would be possible to work out reasonably efficiently / cheaply what the password was - albeit through attacking the data rather than just reversing the transformation. (eg: things like http://project-rainbowcrack.com/ or http://www.openwall.com/john/)

Since you are root it is also possible to attack the user password at another level - replace the login binary, or sudo, or part of PAM, etc, with something that will capture the password when it is entered.

So, in specific, no, but in general having root access does make it easier to get at the users details through various side-channels.

Related Question