Created
March 6, 2012 22:16
-
-
Save fduran/1989361 to your computer and use it in GitHub Desktop.
Find Linux users that can log in with password
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# www.fduran.com | |
# Check which Linux users could log in with password, see "man shadow" for the second field in the /etc/shadow file: | |
# "If the password field contains some string that is not a valid result of crypt(3), for instance ! or *, the user will not be able to use a unix password to log in (but the user may log in the system by other means). | |
# this awk one-liner will find users that have common used * or ! in the password field or field starts with ! (locked account). It's possible that still found user cannot log in due to other non-crypt character in the field | |
awk -F: '$2 != "*" && $2 !~ /^!/ { print $1, " can log in" }' /etc/shadow |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment