LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Blogs > w322
User Name
Password

Notices

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

  



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

Main Menu
Advertisement

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