0

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.

singpolyma
  • 489
  • 2
  • 7
  • 19

1 Answers1

1

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.

Alex
  • 1,103
  • 6
  • 12