Advertisement
fduran

Find Linux users that can log in with password

Mar 6th, 2012
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.62 KB | None | 0 0
  1. # www.fduran.com
  2. # Check which Linux users could log in with password, see "man shadow" for the second field in the /etc/shadow file:
  3. # "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).
  4. # 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 character
  5.  
  6. awk -F: '$2 != "*" && $2 !~ /^!/ { print $1, " can log in" }' /etc/shadow
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement