I am looking for a way to edit and enforce log on hours for individual users on a machine.

So far, from what I have been able to find, 2 tools (timekpr and gnome nanny) arent available for use in the newer versions of Ubuntu.

I tired using PAM and editing the time.conf file located in /etc/security/ to set log on hours for users, however, it didnt seem to work. No matter what I set, after rebooting it didnt enforce the rules that I set.

How can I set log on hours for users? Are there any other programs or applications that help with this? Im using Ubuntu 13.10.

Also, are there any applications that allow me to manager user accounts remotely from another machine, sort of like how MMC console in Windows works?


1 Answer 1


To use the PAM time module edit /etc/security/time.conf with your desired access limitations. The line below restricts USERNAME to system access 7am to 10pm, everyday of the week.


Now you need to enable the time module in the service that controls system logins.

To enable the time module in lightdm edit /etc/pam.d/lightdm to include:

account required pam_time.so

You can also add that line to /etc/pam.d/gdm if you use gdm instead of lightdm

To enable the time restrictions across all service edit /etc/pam.d/login.

You should find: # account required pam_time.so.

Remove the comment mark to enable it.

  • This has worked. The instructions I found elsewhere did not have me make any changes to lightdm. The only thing I think that I would like to change is the error message at the login screen when a user tries to login outside their allotted hours. Right now it says "Invalid password, please try again". Feb 20, 2014 at 0:07
  • @DominickIntorre: that's the message lightdm spits out on PAM deny. Nothing we can do easily for that. Two caveats to note: 1) by using pam_time a user will not be kicked off in case the time was way out of the limits 2) Users will not be able to shutdown in case somebody still was logged in.
    – Takkat
    Feb 20, 2014 at 12:11

Not the answer you're looking for? Browse other questions tagged .