Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-28-2012, 10:23 AM   #1
Registered: Nov 2011
Posts: 47

Rep: Reputation: Disabled
check how many days has been an account inactive

hi, how can one check for how many days an user hasn't logged into they account ?

i know there is command:
last user
that tells me when was last logged in but i want to have number of days that the user hasn't logged in.

Old 01-29-2012, 03:08 AM   #2
Senior Member
Registered: May 2010
Location: Planet Earth
Distribution: Debian
Posts: 1,030

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380

Old 01-29-2012, 11:31 AM   #3
Senior Member
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 13.1
Posts: 1,330

Rep: Reputation: 254Reputation: 254Reputation: 254
last will only work on the latest wtmp file, which might have been rotated already and for former entries you would have to scan in the rotated ones.

You can use:
$ lastlog -u user
which will give you the latest time the user was logged in. The difference in days needs to be computed though.


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
Inactive Account Lock pattanaikhr Linux - Software 3 04-21-2011 04:57 AM
account should be expired/locked if not logged in for 15 days through FTP linux_beginer Linux - Server 1 03-26-2011 08:25 AM
account should be expired if not logged in for 15 days through FTP linux_beginer Linux - Server 5 03-24-2011 01:36 AM
to lock the account if not accessed through FTP for 15 days linux_beginer Linux - Newbie 2 03-23-2011 11:46 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:56 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