Visit Jeremy's Blog.
Go Back > Blogs > w322
User Name


Rate this Entry

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:
*; *; sammy; Al0630-2100
edit /etc/pam.d/common-account, add:
account requisite
To force the user to logout at a specific time: run sudo crontab -e and in the editor add:
0 21 * * * skill -KILL -u sammy
The user will be logged out at 9:00 pm.
There is a pretty good crontab turotial at
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
50 20 * * * kdialog --msgbox "You will be logged out in 10 minutes."
Posted in Uncategorized
Views 829 Comments 0
« Prev     Main     Next »


All times are GMT -5. The time now is 06:28 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration