- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- script to find Paaswd age for all users
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2012 11:55 AM
06-05-2012 11:55 AM
script to find Paaswd age for all users
Friends
I want a script to find the passwd age for all users in this server.
The script will give the output as following fields.
username uid passwd age
Ajin.S
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
- Tags:
- passwd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2012 05:39 AM
06-06-2012 05:39 AM
Re: script to find Paaswd age for all users
Hello,
passwd -s <user>
would give some informations about the attributes related to some specific user. Read the passwd man page. You could write a script that will iterate passwd file in order to fin the users from your system and then call passwd -s on those names.
Horia.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2012 05:38 PM - edited 06-06-2012 05:40 PM
06-06-2012 05:38 PM - edited 06-06-2012 05:40 PM
Re: script to find passwd age for all users
>I want a script to find the passwd age for all users in this server.
Perhaps something like:
/usr/sbin/logins -x -a | awk '
BEGIN { print "Username UID passwd-reset" }
{
user = $1
uid = $2
getline; getline; getline
locked = $1
if (locked == "LK") {
printf "%-8s %7s %s\n", user, uid, locked
} else {
date = $2
if (date == "000000") {
printf "%-8s %7s %s\n", user, uid, "No expiration"
} else {
yy = "20" substr(date, 5, 2)
mm = substr(date, 1, 2)
dd = substr(date, 3, 2)
printf "%-8s %7s %s-%s-%s + %s days\n", user, uid, yy, mm, dd, $4
}
}
getline
}'
The user will have to do the date arithmetic to find the expiration date.