Given a linux username and a password how can I test if it is a valid account?
问题 So my question is straight forward given a linux username and a password how can I test if it is a valid account? 回答1: You can validate that a given password is correct for a given username using the shadow file. On most modern distributions, the hashed passwords are stored in the shadow file /etc/shadow (which is only readable by root). As root, pull the line from the shadow file for the given user like so: cat /etc/shadow | grep username You will see something like this: username:$1