How to get a list of users with their password status (expired, account locked...)?
At my company we are migrating from SCO UNIX to RHEL and one of the tasks we often had to do on SCO is get a list of all users whose password has expired and of those, who didn't react, whose account is now locked.
I can imagine this could be done by analyzing the contents of /etc/passwd and /etc/shadow but before going this way, I'd like to know if 1) there is another simpler way to do it 2) if not, then if somebody already has a similar script to share? Thanks a lot in advance |
You're right, the information is in /etc/passwd and /etc/shadow.
Here is a script to get the information, haven't seen a script yet that totally breaks it down by field but I'm sure it can be done. Code:
#!/bin/bash Code:
|
Something like this may get you started...
Code:
#!/bin/bash |
Quote:
Code:
#!/bin/bash |
Cool! Here is the output which looks good except for this part...
date: invalid date ` 99996 day' Code:
List of user accounts with password information |
Can you try this on your shell? This worked fine for me. I don't know why it would return an invalid date on your system?!
Code:
# date +%d"."%m"."%Y -d " 99996 day" |
I'm using FC3 if that matters.
# date +%d"."%m"."%Y -d " 99996 day" date: invalid date ` 99996 day' |
All times are GMT -5. The time now is 08:35 PM. |