This project was born out of frustration that no similar project appears to exist. pam_duration provides a way to limit the number of minutes a given user is allowed to access a system on a given day of the week. This is mostly useful for parental control.
For example, suppose I have three kids: a fifteen year old, a ten year old, and a five year old. The fifteen year old needs access to the computer to work on school reports and homework during the week, and is allowed up to two hours per day on the weekend. The ten year old needs access to the computer to do homework during the week, but his homework requires much less time on the computer. He is granted one hour per day on the weekend. The five year old gets half an hour per day, any day of the week.
Existing PAM modules do not answer this need. pam_duration provides a way to do it. So far it has only been tested on Ubuntu 12.04, since that's what I run. It should run on any POSIX system that supports PAM and has a Python 2.7 interpreter.
There is a PAM module that restricts the hours of the day that users can log in. For example, it can specify that a user is allowed to log in between the hours of 8 am and 5 pm. It doesn't, however, provide a way to limit how much time the user can spend logged in during those hours.
There is another project, Timekpr, that used to do the same thing this module does, but timekpr has not been updated for some time, and is not very portable. Specifically, it does not work with versions of Ubuntu that use the lightdm login manager. The duration-limiting functions of timekpr also don't integrate into the most prevalent authorization framework for Posix systems: PAM.
While pam_duration is not yet as user-friendly as Timekpr (for instance, it does not yet provide notifications to the window manager that the user is about to be logged off, and there is no GUI to configure how long users can log in on what days), it should operate on many more systems.
pam_duration is functional, but unpolished. It needs work in the following areas:
For guidance on building the software, see the [Building] page.
For configuration guidance, see the [Configuration] page.