Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to have some method of determining which user accounts have remained unused for a certain period of time, lock the accounts, and then after a further period, delete the accounts (notifying the user at each step).

These user accounts (in my case) can be used for ssh, ftp, pop3, and webmin/usermin - so any activity of any type should mark the account as active

How can I determine simply which accounts have been unused (for anything) for a certain period of time?

I have written a custom script that parses several logfiles (one for each type of login) every day to determine who has had any activity that day. But I suspect this is not the best way to do this.

Is this the best way to do this, or is there a simpler way (or perhaps a standard utility) to accomplish this?

share|improve this question
up vote 0 down vote accepted

I have written a script that scans all the relevent logs daily, makes a list of people that have had any activity that day, and maintains database (just a text file) of users and the last time they logged in.

Then I have a second script that examines the database for dates more than x days ago, an notifies the user and administrator 2 weeks prior to locking the account. And if there are any dates more than x+y days ago, deletes the account altogether.

This seems to be working for me - but I would like to use a non-proprietary solution if one is available.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.