• Home
  • Codes and Configs
  • Mmm, beer…
  • My Support Questions…
  • Who is symbolik?

Linux Free Trade Zone

Entries RSS | Comments RSS
  • Linux Counter…

    Registered Linux User...
  • Visitors....

    • 240,639 carbon-based bipeds
  • Tags...

    /dev/urandom /var/log/messages Apps beryl Desktops Distros File Systems Firefox Graphics hacking Hardware HowTo Japanese KDE Kernel Kubuntu Links... Linux Microsoft Open-Source Opinion Programming RAID and LVM Security Smartcard Tips… Vista VMWare wireless Xorg
  • Top Clicks...

    • communities.vmware.com/th…
    • scmmicro.com/support/pc-s…
    • translate.google.com/tran…
    • communities.vmware.com/me…
    • kernel.org
    • techxplorer.com/2007/11/1…
    • symbolik.files.wordpress.…
    • knihovny.cvut.cz/ftp/pub/…
    • lastbit.com/pswcalc.asp
    • notepad-plus.sourceforge.…
  • Most Viewed...

    • HOWTO - 64-bit Kernel 2.6.31 and VMware Server 2.0.1...
    • Extracting an MP3 From a YouTube Flash (FLV) Download...
    • SCM SCR-331 USB Smartcard Reader - Firmware Upgrade
    • Using DoD CAC and SmartCard Readers on Linux
    • Web-filtering with Squid, SquidGuard, and Dansguardian
    • VMware Server 2.0.1 and Kernel 2.6.30.1...
    • Some Tips on VMware ESX...
    • Howto - Blacklisting Modules in Kubuntu...
    • Wireless and Kubuntu 9.04...
    • HOWTO - Kubuntu 9.04, RAID-10, LVM2, and XFS...
  • Notes…

    • November 2009 (2)
    • October 2009 (1)
    • September 2009 (4)
    • August 2009 (3)
    • July 2009 (7)
    • June 2009 (2)
    • May 2009 (9)
    • April 2009 (2)
    • February 2009 (6)
    • November 2008 (9)
    • October 2008 (2)
    • September 2008 (6)
    • August 2008 (1)
    • July 2008 (1)
    • May 2008 (1)
    • March 2008 (1)
    • February 2008 (8)
    • January 2008 (1)
    • December 2007 (4)
    • November 2007 (12)
    • October 2007 (1)
    • September 2007 (3)
    • August 2007 (4)
    • July 2007 (1)
    • June 2007 (1)
    • May 2007 (13)
    • April 2007 (6)
    • March 2007 (11)
    • February 2007 (5)
    • January 2007 (6)
    • December 2006 (6)
    • November 2006 (7)
  • Plumbing….

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.com

Controlling Login Access by Time….

Posted on May 28, 2009 by symbolik

As part of continuing to control computer access by my kids (they are good kids, but kids are kids after all), I set about to restrict access by time.  I also wanted a means to automatically log them out, as well as a notification telling them their time was almost up.

Links that helped:

  • http://articles.techrepublic.com.com/5100-10878_11-1055269.html
  • http://ubuntuforums.org/archive/index.php/t-505876.html
  • http://skindley.wordpress.com/2006/12/11/fedora-core-6-controlling-logins-by-time/

It took a little tinkering, but in the end, I added the following line to /etc/pam.d/common-account:

  • account requisite pam_time.so

Because the /etc/pam.d/login and KDM files reference common-account, I did not have to modify them.  I placed it below the existing unix.so entry.

Next, I edited /etc/security/time.conf and added several lines at the bottom:

  • *;*;root|parent-user1|parent-user2;Al0000-2400 #This ensures root and our parent accounts are not restricted.
  • *;*;child1:Al0900-2130 # Child1 is restricted for all services and logins on all days for access between 9 am and 9:30 pm.
  • *;*;child2:Al0900-2130 #Child2 restrictions…

Syntax is described in the man page for time.conf….  Be careful with the logic – piping the two child accounts together on one line did not work.  Separating them into two lines did.

For notification and logoff, I thought about kdialog (zenity if using GNOME), but went for festival instead.  Since there is no GUI notification, I do not have to point it to the right display variable and it gets a little easier.  Plus, there is a definite geek factor here with a talking computer.

I installed festival and the English festvox packages, and then added the lines to /etc/crontab:

  • 28 21 * * * root echo "It is now `date +\%r` .  Time for bed.  Log off now.  You will be rudely ejected in two minutes.  Good night." | festival --tts
  • 30 21 * * * root /usr/bin/skill -KILL -u child1
  • 30 21 * * * root /usr/bin/skill -KILL -u child2

The syntax for cron is found in the man page for crontab, and is also summarized in the crontab itself.

I chose not to use crontab -e and have user-based crontab files – this one is system-wide and is a little easier to work with.  No special editor (I use vi), and when I am done, I restart the cron service:

  • sudo /etc/init.d/cron restart

I tested each step, and it all works on Kubuntu 8.04 just fine.  Now, before 9 am and after 9:30 pm, the kids cannot log in.  At 9:28 pm each night, a Steven Hawking voice will tell them they have two minutes.  At 9:30 pm each night, their sessions are killed.  If they are not on, nothing happens.

Some improvements I can make later is to check and see if they are on before running the festival notification.  I will also play around with more realistic voices for festival.

I also think I will add birthday and holiday notifications in the crontab.  I have already added in a wake-up call to the crontab using festival, and a .wav file will play (you don’t wanna know, trust me – it is very juvenile).  To play files from the command line, I installed sox and all the suggested and recommended packages.  But you probably only need sox.

And of course, there is the mischief factor – SSH, festival, and sox.  Think of the possibilities!   ^__________^

Filed under: HowTo, Security | Tagged: common-account, cron, crontab, festival, festvox, pam, pam.d, sox, text to voice, time.conf

« Kubuntu 9.04 and Flash Audio… Tuning XFS – Useful Links… »

Leave a Reply

Click here to cancel reply.

  • Internet Storm Center Infocon Status
  • Comments...

    TeNeX on HOWTO – 64-bit Kernel 2.…
    Howard Kuntz on What keeps me using Windows at…
    Scott on HOWTO – 64-bit Kernel 2.…
    k on HOWTO – Vanilla Kernel 2…
    Rahul on Stateless VMware ESXi 3.5 on a…
  • RSS Kernels…

    • next-20091219: linux-next
    • 2.6.33-rc1: mainline
    • 2.6.32-git15: snapshot
    • 2.6.32.2: stable
    • 2.6.31.9: stable
  • RSS KDE News…

    • Using KDE Software to Empower Cultural Diversity - an Interview With Vox Humanitatis
    • Exciting Speaker Schedule for Camp KDE 2010
    • Team Sets Seventh Beta of KDevelop4 Loose
    • On Being Part of KDE
  • RSS LinuxToday.com…

    • Editor's Note: Hug Your Favorite FOSS Contributors Today (On the Internet, no one can see you nod.) December 18, 2009
    • Where does Ubuntu go from here? December 18, 2009
    • Ubuntu, Linux, GNOME and Xorg: This Intel-video user is tired December 18, 2009
    • Installing VirtualBox 3.1 On An Ubuntu 9.10 Desktop December 18, 2009
    • The Tech Skills You'll Pay More for in 2010 December 18, 2009
  • RSS SANS…

    • Infocon: green
    • Wireshark 1.2.5 released - including three security fixes , (Fri, Dec 18th)
    • Twitter outage via DNS hijacking, (Fri, Dec 18th)
    • PHP 5.2.12 has been released; contains security fixes. See http://www.php.net, (Thu, Dec 17th)
    • In caches, danger lurks, (Thu, Dec 17th)
  • Links...

    • //Internet Duct Tape
    • /home/liquidat
    • 0ddn1x: tricks with *nix
    • alediaferia::hackingAround()
    • Angry 365 Days a Year
    • Attrition.org
    • element14
    • fullmetalgerbil ex machina
    • IRIS Seismic Monitor
    • Jeff Rasmussen’s Healthcare IT Blog
    • johnboy’s gnu/linux planet
    • Just Free Software
    • kOoLiNuS
    • Linux FUD
    • Mike D’s VMware Blog
    • Motho ke motho ka botho
    • Open Source Advocacy with Reverend Ted
    • Sand and Tsunamis
    • Scott Kindley
    • Six Plates
    • strange maps
    • Technofriends
    • tOMPSON’s blog
    • Tryst with Linux and other Alternatives
    • Virtual Insanity
    • VistaSucks.WordPress.Com
    • VM Junkie
    • WP Hosting
    • Xubuntu-Blog
  • Music…

    • Radio Jazz Plus
    • SOMA-FM
  • Tips…

    • Speed Up Firefox web browser — Ubuntu Geek
    • Useful aliases…
  • Tools…

    • OllyDbg v1.10
    • PEiD
    • Websites as Graphs

Blog at WordPress.com. Theme: Digg 3 Column by WP Designer