
In the digital age, it’s important to ensure that your children are using their computer time wisely and safely. This is especially true if you’re using Ubuntu, a popular Linux distribution known for its flexibility and power. In this guide, we’ll explore how to restrict your kids’ computer access on Ubuntu using various methods.
To restrict your kids’ computer access on Ubuntu, you can use the Linux-PAM module called pam_time to set access restrictions based on time and day of the week. Alternatively, you can use the kidtimer script to track and control computer usage, or create custom shell scripts or cron jobs for more flexibility.
Using Linux-PAM (pam_time)
One of the most effective ways to restrict computer access on Ubuntu is through the Linux-PAM module called pam_time. This module allows you to set access restrictions based on time and day of the week.
Configuring pam_time
To configure pam_time, you’ll need to edit the /etc/security/time.conf
file. Open it using your preferred text editor, such as nano:
sudo nano /etc/security/time.conf
In this file, you can define rules for each user. The syntax for these rules is as follows:
services;ttys;users;times
- services: This can be a specific service like
ssh
orlogin
, or*
for all services. - ttys: This can be a specific terminal, or
*
for all terminals. - users: Specify the username of the child’s account here.
- times: This specifies the time periods when the user is allowed to use the services. The format is
DHHMM-DHHMM
, whereD
is the day of the week (0-6, with 0 being Sunday), andHHMM
is the time in 24-hour format.
For example, to restrict a user named john
from using all services from 8 PM to 8 AM on weekdays, you would add the following line:
*;*;john;1-41000-2000,2-41000-2000,3-41000-2000,4-41000-2000,5-41000-2000
Save and close the file to apply the changes.
Using kidtimer Script
Another option is to use the kidtimer script, which is available on GitHub. This script allows you to track and control the computer usage of user accounts.
Installing and Configuring kidtimer
First, download the script from the GitHub repository. Then, make the script executable and move it to /usr/local/bin
:
chmod +x kidtimer
sudo mv kidtimer /usr/local/bin/
To configure kidtimer, you need to edit the kidtimer.conf
file. This file allows you to set daily usage limits and configure periods of the day when users can or cannot log in.
Custom Shell Scripts or Cron Jobs
If the above solutions don’t meet your needs, you can create custom shell scripts or cron jobs to enforce restrictions. This requires some programming knowledge but can be a flexible solution tailored to your specific needs.
For example, you could create a cron job that logs out a user at a certain time. Open the crontab file with:
crontab -e
Then, add a line like this to log out john
at 8 PM:
0 20 * * * pkill -KILL -u john
Remember to replace john
with the username of your child’s account.
Conclusion
While some previously popular solutions for restricting computer access on Ubuntu are no longer available or have issues, there are still viable methods such as using pam_time, the kidtimer script, or custom shell scripts/cron jobs. With these tools, you can ensure that your children are using their computer time responsibly.
Ubuntu is a popular Linux distribution known for its flexibility and power. It is an open-source operating system based on the Debian architecture.
Yes, you can configure access restrictions for multiple users by adding separate rules for each user in the /etc/security/time.conf
file when using the pam_time module.
Time periods in pam_time are specified using the format DHHMM-DHHMM
, where D
is the day of the week (0-6, with 0 being Sunday), and HHMM
is the time in 24-hour format. For example, 1-41000-2000
represents Monday from 8 PM to 8 AM.
Yes, you can define rules in the /etc/security/time.conf
file to restrict access to specific services like ssh
or login
by specifying the service name in the "services" field of the rule.
The kidtimer script can be downloaded from the GitHub repository at https://github.com/zzzkeil/kidtimer.
You can make the kidtimer script executable by running the command chmod +x kidtimer
in the terminal.
The kidtimer.conf file allows you to set daily usage limits. You can edit this file to specify the desired limits for each user account.
Yes, creating custom shell scripts or cron jobs requires some programming knowledge. It involves writing scripts or commands that enforce the desired restrictions based on your specific needs.
Yes, you can create a cron job that logs out a user at a specific time by adding a line to the crontab file using the crontab -e
command. The line should include the appropriate command to log out the user.
Yes, apart from using pam_time or the kidtimer script, you can explore other methods like parental control software or network-level restrictions to further restrict computer access on Ubuntu.