rolanaj Posted July 17, 2007 Share Posted July 17, 2007 I am trying to limit the amount of time my son spends online, he'll stay there all day if I don't stop him. Is there any program I can use to track how much time he is logged into the internet each day? I know I can change the password and then I have to be here to let him online, but I kind of want to let him be responsible for his online time. I use Mandriva Spring and we are on dial up. Any suggestions anyone? Quote Link to comment Share on other sites More sharing options...
Bruno Posted July 17, 2007 Share Posted July 17, 2007 I do not know of software that does this monitoring for you, but I am sure it is available and maybe even in the repositories.The only thing I know is that you can give the command "w" and it will show you what user has been logged in for how log with the exact time. ( but rebooting resets the time )BUT if it is the online-time ( connected ) you want to monitor: kppp has a log with exact times your computer was connected and how many MB was transferred. Bruno Quote Link to comment Share on other sites More sharing options...
striker Posted July 17, 2007 Share Posted July 17, 2007 GnoTime maybe ?http://www.linux.com/articles/57682 Quote Link to comment Share on other sites More sharing options...
steel Posted July 18, 2007 Share Posted July 18, 2007 hi rolanajI read this post 3x, i am curious why you would want to log his time sure you can create logs and keep track if everything he does if you want, BUT you would be up to your eye balls in logs files and they really grow huge fast if you dont pay attention to them .... if you just want him to be off the net or even the computer at a certain time thats easy to do, there are two ways you can do that on your mandrake, 1) one way is using the config security file, 2) using cron .... thats what i would do myself if i think that #1) would be the easiest and either Bruno, Striker or myself can help you with that its easy enough to do .... and you can set the times he can be online example say from 7pm --11pm ... mon tru Thurs .... 9am --2am on weekends .. its up to you when set up his times .... Quote Link to comment Share on other sites More sharing options...
striker Posted July 18, 2007 Share Posted July 18, 2007 There's also Dansguardian, one of the best filters out there with possible white and blacklisting. That's omething other than just timing measures but I think maybe it's just what you may be looking for after all. Quote Link to comment Share on other sites More sharing options...
rolanaj Posted July 18, 2007 Author Share Posted July 18, 2007 Well I looked for the Kpp log file and what I found did not show me when anyone was logged in it just showed when it had been updated from what I can make out.You're right Steel its not really logging his time so much as limiting his time online that I am interested in. If you can walk me through how to set up a cron job or something that would be great. The thing is the time may not be consistent, but the amount of time he is allowed online is he gets 2 hours a day and that is supposed to be it. Of course if we have to set it up to a certain time a day we can arrange that. Quote Link to comment Share on other sites More sharing options...
Bruno Posted July 18, 2007 Share Posted July 18, 2007 Hi RolanaThe idea Steel has is pretty good . . . but what he will need from you to make the code are:- The login name of your son- The 2 hours you allow him every day to use the computerB) Bruno Quote Link to comment Share on other sites More sharing options...
rolanaj Posted July 19, 2007 Author Share Posted July 19, 2007 Ok so the log in name is greg but is there anyway to set up different times for different days? Quote Link to comment Share on other sites More sharing options...
Bruno Posted July 19, 2007 Share Posted July 19, 2007 I'd say if for example you want from 4 to 6 PM in weekdays and 3 to 8 PM on weekends . . . that it would be possible. Bruno Quote Link to comment Share on other sites More sharing options...
rolanaj Posted July 20, 2007 Author Share Posted July 20, 2007 Oh ok that would be handy, I'll have to negotiate times with him and I'll let you know. Quote Link to comment Share on other sites More sharing options...
Bruno Posted July 21, 2007 Share Posted July 21, 2007 I'll have to negotiate times with him . . . well good luck on that one . . . Bruno Quote Link to comment Share on other sites More sharing options...
rolanaj Posted July 25, 2007 Author Share Posted July 25, 2007 Been there done that eh? Teenagers can be so annoying! I guess i will pick the hours myself. I figure between 6-8 p.m. Monday- Friday and between 4-9 p.m. on Saturday and Sunday. Apparently they have clan battles some times, and he couldn't pick a time. Quote Link to comment Share on other sites More sharing options...
Bruno Posted July 25, 2007 Share Posted July 25, 2007 Okay . . . . . here is the code for Mandriva: ( I tested it and it works )Before you start make backups of the most important files you are going to change: # cp /etc/security/time.conf /etc/security/time.conf-BACKUP# cp /etc/pam.d/kde3 /etc/pam.d/kde3-BACKUP# cp /etc/pam.d/login /etc/pam.d/login-BACKUP Then first open the /etc/security/time.conf file and add at the bottom: login|kde3;*;greg;Wk1800-2000 | Wd1600-2100Next open the /etc/pam.d/kde3 file and just below the "auth" entries add the line : account required pam_time.soNext open the /etc/pam.d/login file and again just below the "auth" entries add the line : account required pam_time.soNext, if you are not 100% confortable with the Vi editor: logged in as "su" give the command # export EDITOR=mcedit ( if you like Vi you can skip that command. ) This way you can edit the contrab file in the MC editorNext give the command: # crontab -e and put this in the file: 10 21 * * 6-7 /usr/bin/skill -KILL -u greg10 20 * * 1-5 /usr/bin/skill -KILL -u gregFinally give the command # crontab -u greg -e and put this in that file: 01 21 * * 6-7 /usr/bin/zenity --warning --title "Alert" --display=:0 --text "Time is up, you will automatically be logged out in 9 minutes"01 20 * * 1-5 /usr/bin/zenity --warning --title "Alert" --display=:0 --text "Time is up, you will automatically be logged out in 9 minutes"What this all means:He can log in only from n 6-8 p.m. Monday- Friday and between 4-9 p.m. on Saturday and Sunday . . . . he will automatically be logged out at 20.10 during the week and 21.10 in the weekends ( gave him 10 minutes extra ) . . but he will get a popup at 20.01 and 21.01 telling him that "Time is up, you will automatically be logged out in 9 minutes" so he can finish up and save his "work". NOTES: - you will have to password protect the BIOS to prevent live CD/DVD booting of Live CD/DVD- remove the "failsafe" option from the bootmenu- if he knows the root-password he will be able to get around the lock we make- if he knows your password he can login to your account- if you multiboot he will be able to just start up another distro- once the above code is implemented there is no way around the lock, so even yourself you will not be able give him an extra hour . . . sorry. Bruno Quote Link to comment Share on other sites More sharing options...
rolanaj Posted July 27, 2007 Author Share Posted July 27, 2007 Ok I ran into a problem all ready cp /etc/security/time.conf /etc/security/time.conf-BACKUP[root@localhost rolana]# cp /etc/pam.d/kde3 etc/pam.d/kde3-BACKUPcp: cannot create regular file `etc/pam.d/kde3-BACKUP': No such file or directory[/copy]I didn't go any farther as I figure I probably should get this backed up first.I did however change the dialup password, my password and the root password so even if he boots into another distro he won't be able to connect. Quote Link to comment Share on other sites More sharing options...
steel Posted July 27, 2007 Share Posted July 27, 2007 Ok I ran into a problem all readycp /etc/security/time.conf /etc/security/time.conf-BACKUP[root@localhost rolana]# cp /etc/pam.d/kde3 etc/pam.d/kde3-BACKUPcp: cannot create regular file `etc/pam.d/kde3-BACKUP': No such file or directory hi Rolanayeah you see the problem??? # cp /etc/pam.d/kde3 etc/pam.d/kde3-BACKUPyou forgot the # cp /etc/pam.d/kde3 /etc/pam.d/kde3-BACKUP Quote Link to comment Share on other sites More sharing options...
Bruno Posted July 27, 2007 Share Posted July 27, 2007 you forgot the # cp /etc/pam.d/kde3 /etc/pam.d/kde3-BACKUPThat was my mistake . . . I made an error in the instructions I posted . . . sorry about that.I did correct the original post. Bruno Quote Link to comment Share on other sites More sharing options...
rolanaj Posted July 28, 2007 Author Share Posted July 28, 2007 Ok looks like everything went ok this time, but I'll have to wait until tomorrow and see how he makes out to know for sure.He liked the extra 10 minutes by the way :)Thanks so much to both of you, this is really helpful. Quote Link to comment Share on other sites More sharing options...
steel Posted July 28, 2007 Share Posted July 28, 2007 Ok looks like everything went ok this time, but I'll have to wait until tomorrow and see how he makes out to know for sure.Thanks so much to both of you, this is really helpful.I am glad that everything worked out Rolana, that should keep your son outta trouble and in check now as long as you dont give him your username and password ........ and all the credit goes to Bruno he did all the work That was my mistake . . . I made an error in the instructions I posted . . . sorry about that.I did correct the original post. BrunoNo worries Bruno, if all my mistakes were small like that i would be a very happy camper Quote Link to comment Share on other sites More sharing options...
Bruno Posted July 28, 2007 Share Posted July 28, 2007 You're very welcome Rolana !You can test the 2 most essetial commands like this:( as user ) $ /usr/bin/zenity --warning --title "Alert" --display=:0 --text "YES, this works as advertised" This should trigger a popup.( as root ) # /usr/bin/skill -KILL -u greg This should log out the user "greg"If those 2 commands do what they promisse you only have to test if he can log in before/after the hours he's permitted. BrunoPS: @Steel Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.