Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there a good way (on networked *nix systems) to keep track of how much time user accounts have been logged in on a daily/weekly/monthly basis?

Also, it would be cool if I could set adjustable time quotas on user accounts, so that they would be logged out if they stayed on a system more than N minutes.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

The files /var/log/wtmp or utmp track log-ins and log-outs.

'last' will show you last log-ins and and time logged in.

You could probably write a script run via cron that tracks usage and kills the users log-in. If you wanted them to then be blocked you could edit their entry in /etc/password. You'd have to keep track and unblock it later though. Or, just have a job to enable all users at midnight, or similar.

Alternatively just run finger or pink through cron and kill of active sessions that have been on too long.

Idled can be configured to kill off idle sessions that have hit a threshold.

If you're keen on also reporting, etc you might want to invest in a monitoring tool like nagios to monitor and run the corrective action for you. They can then also log the usage metrics to a db and you can report from that.

share|improve this answer
add comment

Your Answer

 
discard

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.