Hi All,
How do I grep and link the relationship between /etc/passwd and /etc/shadow?
Thank you in advance.
Hi All,
How do I grep and link the relationship between /etc/passwd and /etc/shadow?
Thank you in advance.
An example to print the maximum number of days the password is valid for users with a userid under 100:
awk -F: 'NR==FNR && $3 < 100 {a[$1];next} $1 in a {print $5}' /etc/passwd /etc/shadow
BTW you must have root permission to read the /etc/shadow file.
Regards
I'd like to show the login and userid which I can't, can you please modify it.
BTW, the one showing is the 5th element on /etc/shadow (most of them are 91).
Thanks again.
Then it's unnecessary to read the shadow file:
awk -F: '$3 < 100{print "Login: "$1, "UserID: "$3}' /etc/passwd
Regards