LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 05-21-2004, 07:30 AM   #1
jdc2048
Member
 
Registered: Jul 2002
Distribution: Redhat, Gentoo, Solaris, HP-UX, etc...
Posts: 391

Rep: Reputation: 30
Getting password expiry for all accounts in a single command


I am hoping this will be an easy one for someone. I am trying to get a list of password expiry on all accounts on several linux servers. I have found things like "passwd -S <user>" and "chage -l <user>" but I want one that dumps the whole list of accounts from the server in one foul swoop instead of by account.
 
Old 05-25-2004, 03:09 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Write a script or shell function?
 
Old 05-26-2004, 08:14 AM   #3
jdc2048
Member
 
Registered: Jul 2002
Distribution: Redhat, Gentoo, Solaris, HP-UX, etc...
Posts: 391

Original Poster
Rep: Reputation: 30
Yeah, my co-worker wound up writing some regex stuff to get what we wanted. This was a crunch thing and didn't have time for much shell scripting. For anyone interested in other flavors the following will output the password expiry stuff in a single-line per user output.

Code:
Solaris (as root);
passwd -as

AIX (as root);
lsuser -a expires minlen minage maxage maxexpired ALL
And for Linux I had to do this which dumps out multiple lines per user;
Code:
for i in `cat /etc/passwd | awk -F: '{print $1}'`; do echo "UserName:\t${i}"; chage -l $i;done
From there it is regex h3ll to get all of this formatted nice and manager friendly. Neither of the flavors looks the same as the other, so you wind up having to write 3 different functions to parse the output.

Last edited by jdc2048; 05-26-2004 at 08:16 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a single command to list all hardware installed (command line)? davee Linux - Hardware 6 02-28-2009 07:19 PM
Backup and restore accounts and password jorasmi Slackware 1 02-17-2005 09:24 PM
SAmba Password Expiry bally Linux - General 0 11-29-2004 10:42 PM
incorrect password (can single, but can't su) david_reno Linux - Software 2 06-19-2003 09:42 PM
Password expiry klmn1 Linux - Networking 0 12-29-2002 10:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 02:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration