Limit Times a User Can Use The Computer
Posted 10-29-2007 at 09:27 PM by w322
If you have children or teenagers, you might want to limit the times of day that they can use the computer. Here is how I did it:
For this example, "sammy" is the username of the user to be limited.
To limit when the user can login, edit /etc/security/time.conf and add:
edit /etc/pam.d/common-account, add:
To force the user to logout at a specific time: run sudo crontab -e and in the editor add:
The user will be logged out at 9:00 pm.
There is a pretty good crontab turotial at http://ubuntuforums.org/showthread.php?t=102626
If you have not edited a crontab entry before, here is a tip: when you are done, press ctrl-o to save the file but don't change the filename (crontab will be looking for the filename given), then press ctrl-x to exit.
If you want to get fancy, you can give the user a warning notification:
sudo -u sammy crontab -e
For this example, "sammy" is the username of the user to be limited.
To limit when the user can login, edit /etc/security/time.conf and add:
Code:
*; *; sammy; Al0630-2100
Code:
account requisite pam_time.so
Code:
0 21 * * * skill -KILL -u sammy
There is a pretty good crontab turotial at http://ubuntuforums.org/showthread.php?t=102626
If you have not edited a crontab entry before, here is a tip: when you are done, press ctrl-o to save the file but don't change the filename (crontab will be looking for the filename given), then press ctrl-x to exit.
If you want to get fancy, you can give the user a warning notification:
sudo -u sammy crontab -e
Code:
50 20 * * * kdialog --msgbox "You will be logged out in 10 minutes."