Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-29-2008, 01:50 PM   #1
LQ Newbie
Registered: Feb 2008
Posts: 22

Rep: Reputation: 15
Terminal Command to find out expiry date on user accounts

I am a student writing their first bash script. In it we need to make expiry dates for users to expire in one year after creation. I think i did it. Is there a terminal command to see the expiry dates on user accounts?

Thanks in advance

Old 02-29-2008, 03:19 PM   #2
Registered: Feb 2008
Location: Texas
Distribution: Fedora, RHEL, CentOS
Posts: 488

Rep: Reputation: 78
chage -l <username>
should show you information regarding password expirations, min/max days between password changes, ... so you can see if your script is working correctly or not.
Old 02-29-2008, 03:38 PM   #3
LQ Newbie
Registered: Feb 2008
Posts: 22

Original Poster
Rep: Reputation: 15
Thanks a lot.... thot i tried that, gues snot.. Your the best!!
Old 02-29-2008, 04:47 PM   #4
Senior Member
Registered: May 2006
Distribution: Caldera, CTOS, Debian, FreeBSD, Mac OS X, Mandrake, Minix, OpenBSD, Slackware, SuSE
Posts: 1,757

Rep: Reputation: 80
Here's a quick script based on chage. Replace the 1000 in test for what ever is the beginning user account UID on your system.

while read inputline
        NAME="$(echo $inputline | cut -d: -f1)"
        ID="$(echo $inputline | cut -d: -f3)"
        if [ $ID -ge 1000 ]; then
        echo -n "User: " $NAME " => " ; chage -l $NAME | grep "Account Expires"
done < /etc/passwd



Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
User login expiry date? geekgrl Linux - Security 7 07-04-2011 06:08 AM
Can I retrieve certificate expiry date from an openssl certificate (command line) davee Linux - Security 1 07-21-2006 10:28 AM
List of All user accounts from command line sniff Linux - General 4 07-09-2006 11:02 AM
Getting password expiry for all accounts in a single command jdc2048 Linux - Security 2 05-26-2004 08:14 AM
disabling user accounts via command line n1wil Linux - Security 3 07-25-2003 05:11 PM

All times are GMT -5. The time now is 11:17 AM.

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