LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices

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

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


Hey,
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

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

Rep: Reputation: 73
Code:
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
Caighil
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
bsdunix
Senior Member
 
Registered: May 2006
Distribution: Caldera, CTOS, Debian, FreeBSD, Mac OS X, Mandrake, Minix, OpenBSD, Slackware, SuSE
Posts: 1,757

Rep: Reputation: 78
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.
Code:
#!/bin/sh

while read inputline
do
        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"
        fi
done < /etc/passwd
 
  


Reply

Tags
command


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
Trackbacks are Off
Pingbacks are On
Refbacks are 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 09:15 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration