The CLL is setting up a public access machine in the next couple of weeks. It is installed with Mint 8 (a multimedia Ubuntu fork). I would like to set up a couple of init scripts. The first will delete the public account home directory and copy a "clean" version in its place each time the computer starts. The second will shut down the computer after half an hour of use.
I haven't touched on cron since university 20 years ago and I've never written an init script. Having written a few shell scripts I know the copy script should be very simple. I'm not sure how to set up the timer script or make them run on start up. Would anybody be able to fire off some quick directions?
This may be a "foot in the door" situation.
Later Mike
A foot in the door for more unpaid work?
OTTOMH:
Your user is publicuser. Store your skeleton in /usr/local/etc/publicuser.
In rc.local or whatever Mint calls it:
rm -rf /home/publicuser (cd /usr/local/etc && tar -cf - publicuser) | (cd /home && tar -xf -)
In the skeleton's .bashrc
echo "reboot" | at now + 30 minutes
I'd hate to be around when someone is typing an email at T+00:30:01 though. Maybe a few minutes googling for "linux kiosk" will find a far more elegant solution. Not sure if you chose Mint because you like it or you have a particular need, but there appear to be some custom distributions or packages made for this exact purpose.
This also assumes the user can reboot the computer from the command line. It works in Red Hat/Fedora.
Sean
On Mon, Dec 7, 2009 at 11:33 AM, Mike Pfaiffer high.res.mike@gmail.comwrote:
The CLL is setting up a public access machine in the next couple of
weeks. It is installed with Mint 8 (a multimedia Ubuntu fork). I would like to set up a couple of init scripts. The first will delete the public account home directory and copy a "clean" version in its place each time the computer starts. The second will shut down the computer after half an hour of use.
I haven't touched on cron since university 20 years ago and I've
never written an init script. Having written a few shell scripts I know the copy script should be very simple. I'm not sure how to set up the timer script or make them run on start up. Would anybody be able to fire off some quick directions?
This may be a "foot in the door" situation. Later Mike
Roundtable mailing list Roundtable@muug.mb.ca http://www.muug.mb.ca/mailman/listinfo/roundtable
I was just typing something almost identical!
Check out /etc/init.d/README and use /etc/init.d/rc.local (if Mint correponds with /etc/ layout of Ubuntu Server).
Assuming you are in init 5 you can just TERM/HUP (can't remember which, don't use X much) the root X process and it will respawn... but doing via cron is kinda fugly.
Calculate the 'limit' and inject that into root's cron (root so the user can't disable it). Cron runs at specific times so you need to calculate when to run it and specify it exactly such that if I log in at 9:30am (today) the following happens (you need to generate the first four numbers [minute,hour,day of month,month, day of week as per crontab(5)]): echo "0 10 6 12 * pkill -TERM Xserver" | sudo crontab -e
Using at(1) is a better option but do it as a wheel priviledged user... does wheel even translate to Linux?? (sry.. BSD thing, if not use root).
On 2009-12-07, at 11:47 AM, Sean Walberg wrote:
A foot in the door for more unpaid work?
OTTOMH:
Your user is publicuser. Store your skeleton in /usr/local/etc/publicuser.
In rc.local or whatever Mint calls it:
rm -rf /home/publicuser (cd /usr/local/etc && tar -cf - publicuser) | (cd /home && tar -xf -)
In the skeleton's .bashrc
echo "reboot" | at now + 30 minutes
I'd hate to be around when someone is typing an email at T+00:30:01 though. Maybe a few minutes googling for "linux kiosk" will find a far more elegant solution. Not sure if you chose Mint because you like it or you have a particular need, but there appear to be some custom distributions or packages made for this exact purpose.
This also assumes the user can reboot the computer from the command line. It works in Red Hat/Fedora.
Sean
On Mon, Dec 7, 2009 at 11:33 AM, Mike Pfaiffer high.res.mike@gmail.com wrote: The CLL is setting up a public access machine in the next couple of weeks. It is installed with Mint 8 (a multimedia Ubuntu fork). I would like to set up a couple of init scripts. The first will delete the public account home directory and copy a "clean" version in its place each time the computer starts. The second will shut down the computer after half an hour of use.
I haven't touched on cron since university 20 years ago and I've never
written an init script. Having written a few shell scripts I know the copy script should be very simple. I'm not sure how to set up the timer script or make them run on start up. Would anybody be able to fire off some quick directions?
This may be a "foot in the door" situation. Later Mike
Roundtable mailing list Roundtable@muug.mb.ca http://www.muug.mb.ca/mailman/listinfo/roundtable
-- Sean Walberg sean@ertw.com http://ertw.com/ _______________________________________________ Roundtable mailing list Roundtable@muug.mb.ca http://www.muug.mb.ca/mailman/listinfo/roundtable
Sean Walberg wrote:
A foot in the door for more unpaid work?
OTTOMH:
Not sure what this acronym stands for.
Your user is publicuser. Store your skeleton in /usr/local/etc/publicuser.
In rc.local or whatever Mint calls it:
rm -rf /home/publicuser (cd /usr/local/etc && tar -cf - publicuser) | (cd /home && tar -xf -)
In the skeleton's .bashrc
echo "reboot" | at now + 30 minutes
I'd hate to be around when someone is typing an email at T+00:30:01 though. Maybe a few minutes googling for "linux kiosk" will find a far more elegant solution. Not sure if you chose Mint because you like it or you have a particular need, but there appear to be some custom distributions or packages made for this exact purpose.
The idea is to limit usage to 30 minutes to give other people a chance at the machine. There are only two machines and the other /may/ be moved to Linux if this one works out.
The reason for Mint is because it's what we had around. We could have gone with Kubuntu 9.10 but there seem to be some issues which aren't in Mint 8. The kiosk idea sounds worth looking at. If it's what we're looking for I'll have to convince the people in charge to move from Mint to "kiosk".
This also assumes the user can reboot the computer from the command line. It works in Red Hat/Fedora.
It should. I'll find out shortly.
Sean
Thanks for the help. I'll be able to access the machine on Friday. We'll see what happens then.
Later Mike
On Mon, Dec 7, 2009 at 11:33 AM, Mike Pfaiffer <high.res.mike@gmail.com mailto:high.res.mike@gmail.com> wrote:
The CLL is setting up a public access machine in the next couple of weeks. It is installed with Mint 8 (a multimedia Ubuntu fork). I would like to set up a couple of init scripts. The first will delete the public account home directory and copy a "clean" version in its place each time the computer starts. The second will shut down the computer after half an hour of use. I haven't touched on cron since university 20 years ago and I've never written an init script. Having written a few shell scripts I know the copy script should be very simple. I'm not sure how to set up the timer script or make them run on start up. Would anybody be able to fire off some quick directions? This may be a "foot in the door" situation. Later Mike _______________________________________________ Roundtable mailing list Roundtable@muug.mb.ca <mailto:Roundtable@muug.mb.ca> http://www.muug.mb.ca/mailman/listinfo/roundtable
-- Sean Walberg <sean@ertw.com mailto:sean@ertw.com> http://ertw.com/
Sean Cody wrote:
Sounds like a perfect opportunity to setup a VM to play with... then you don't have to wait until Friday to test.
Good idea. I can get on it in a couple hours instead of a few days.
BTW, looks like the 'echo "reboot" | at now + 30 minutes' didn't work out too well from the command line. I think at minimum it would need a sudo command.
I'll need to think about your previous reply some more. I think the solution is close.
Later Mike
On 2009-12-07, at 12:02 PM, Mike Pfaiffer wrote:
Thanks for the help. I'll be able to access the machine on Friday. We'll see what happens then.
-- Sean
Roundtable mailing list Roundtable@muug.mb.ca http://www.muug.mb.ca/mailman/listinfo/roundtable
On 07/12/2009 12:40 PM, Mike Pfaiffer wrote:
Sean Cody wrote:
Sounds like a perfect opportunity to setup a VM to play with... then you don't have to wait until Friday to test.
Good idea. I can get on it in a couple hours instead of a few days.
BTW, looks like the 'echo "reboot" | at now + 30 minutes' didn't work out too well from the command line. I think at minimum it would need a sudo command.
If you're going to enable specific commands in /etc/sudoers, I'd recommend you enable access to the reboot command, rather than access to the at or crontab commands. The latter two would open up all sorts of possibilities for exploitation, whereas the former shouldn't make the machine more vulnerable to anything other than a premature reboot.
Gilles Detillieux wrote:
On 07/12/2009 12:40 PM, Mike Pfaiffer wrote:
Sean Cody wrote:
Sounds like a perfect opportunity to setup a VM to play with... then you don't have to wait until Friday to test.
Good idea. I can get on it in a couple hours instead of a few days. BTW, looks like the 'echo "reboot" | at now + 30 minutes' didn't
work out too well from the command line. I think at minimum it would need a sudo command.
If you're going to enable specific commands in /etc/sudoers, I'd recommend you enable access to the reboot command, rather than access to the at or crontab commands. The latter two would open up all sorts of possibilities for exploitation, whereas the former shouldn't make the machine more vulnerable to anything other than a premature reboot.
First I've confirmed the reboot/halt command needs to be performed as root under Mint. Makes sense.
When it comes to enabling access to the reboot/halt command, this would be done through file permissions?
Later Mike
Mike Pfaiffer wrote:
First I've confirmed the reboot/halt command needs to be performed as root under Mint. Makes sense.
When it comes to enabling access to the reboot/halt command, this would be done through file permissions?
It could.. but its a bad idea. A better solution would be to allow the user access to it via sudo. Try out 'visudo' and the man page of 'sudoers'.
When sudo is setup correctly, certain users can execute commands as root, so no changes to filesystem permissions are required. Just prefix the command with sudo .. ie "sudo shutdown -rn now" or "sudo reboot".
All the best, Robert
Robert Keizer wrote:
Mike Pfaiffer wrote:
First I've confirmed the reboot/halt command needs to be performed
as root under Mint. Makes sense.
When it comes to enabling access to the reboot/halt command, this
would be done through file permissions?
It could.. but its a bad idea. A better solution would be to allow the user access to it via sudo. Try out 'visudo' and the man page of 'sudoers'.
When sudo is setup correctly, certain users can execute commands as root, so no changes to filesystem permissions are required. Just prefix the command with sudo .. ie "sudo shutdown -rn now" or "sudo reboot".
Actually I'd like it to be done at the system init level. Hope I'm using the correct terminology. Through something which is set up at startup. This way it is out of control of the user. Last week we had someone who was on the single machine all day and wouldn't budge. If he could figure out how to disable the shutdown idea we're discussing he would. This way if the machine shuts down and there is someone waiting to get on they can say he had his half hour and boot him off. If he's the only person there then he can restart since all he does is facebook and the like.
What we can do is create a user account without privileges or sudo access so they can't mess up the machine. We can then use a different account for updates etc..
BTW, I've just set up Virtual Box and downloaded a couple of kiosk distros. I think the first was Webkiosk. It seemed to work OK. They want $200US to configure it for us. Maybe we can try it in the other machine for a while on Friday and see if we can get by without any changes. The other one is Pynx|Kiosk. I'll look at that one after I get back in a couple of hours. Any suggestions for others to look at? I'll be at tomorrows meeting and ask again there.
All the best, Robert
Later Mike
FYI: there's this distro too: http://distrowatch.com/?newsid=05761
-Montana Blog and Aggregation Site: http://montanaquiring.info iPhone/Touch Apps I have bought: http://appshopper.com/feed/user/antikx/myapps
On Mon, Dec 7, 2009 at 2:58 PM, Mike Pfaiffer high.res.mike@gmail.comwrote:
Robert Keizer wrote:
Mike Pfaiffer wrote:
First I've confirmed the reboot/halt command needs to be performed
as root under Mint. Makes sense.
When it comes to enabling access to the reboot/halt command, this
would be done through file permissions?
It could.. but its a bad idea. A better solution would be to allow the user access to it via sudo. Try out 'visudo' and the man page of
'sudoers'.
When sudo is setup correctly, certain users can execute commands as root, so no changes to filesystem permissions are required. Just prefix the command with sudo .. ie "sudo shutdown -rn now" or "sudo reboot".
Actually I'd like it to be done at the system init level. Hope I'm
using the correct terminology. Through something which is set up at startup. This way it is out of control of the user. Last week we had someone who was on the single machine all day and wouldn't budge. If he could figure out how to disable the shutdown idea we're discussing he would. This way if the machine shuts down and there is someone waiting to get on they can say he had his half hour and boot him off. If he's the only person there then he can restart since all he does is facebook and the like.
What we can do is create a user account without privileges or sudo
access so they can't mess up the machine. We can then use a different account for updates etc..
BTW, I've just set up Virtual Box and downloaded a couple of kiosk
distros. I think the first was Webkiosk. It seemed to work OK. They want $200US to configure it for us. Maybe we can try it in the other machine for a while on Friday and see if we can get by without any changes. The other one is Pynx|Kiosk. I'll look at that one after I get back in a couple of hours. Any suggestions for others to look at? I'll be at tomorrows meeting and ask again there.
All the best, Robert
Later Mike
Roundtable mailing list Roundtable@muug.mb.ca http://www.muug.mb.ca/mailman/listinfo/roundtable
Montana Quiring wrote:
FYI: there's this distro too: http://distrowatch.com/?newsid=05761
Yeah. That's the one I was thinking of earlier. Like I said it's pretty good. It runs off of a live CD. We may try it on the other machine (M$) on Friday and see what sort of reception we get. If it does what we want, we can yank out the hard drives and maybe add more RAM.
Now I'm back I can try the other one.
-Montana Blog and Aggregation Site: http://montanaquiring.info iPhone/Touch Apps I have bought: http://appshopper.com/feed/user/antikx/myapps
Later Mike
On Mon, Dec 7, 2009 at 2:58 PM, Mike Pfaiffer <high.res.mike@gmail.com mailto:high.res.mike@gmail.com> wrote:
Robert Keizer wrote: > Mike Pfaiffer wrote: >> First I've confirmed the reboot/halt command needs to be performed >> as root under Mint. Makes sense. >> >> When it comes to enabling access to the reboot/halt command, this >> would be done through file permissions? >> > > > It could.. but its a bad idea. A better solution would be to allow the > user access to it via sudo. Try out 'visudo' and the man page of 'sudoers'. > > When sudo is setup correctly, certain users can execute commands as > root, so no changes to filesystem permissions are required. Just prefix > the command with sudo .. ie "sudo shutdown -rn now" or "sudo reboot". Actually I'd like it to be done at the system init level. Hope I'm using the correct terminology. Through something which is set up at startup. This way it is out of control of the user. Last week we had someone who was on the single machine all day and wouldn't budge. If he could figure out how to disable the shutdown idea we're discussing he would. This way if the machine shuts down and there is someone waiting to get on they can say he had his half hour and boot him off. If he's the only person there then he can restart since all he does is facebook and the like. What we can do is create a user account without privileges or sudo access so they can't mess up the machine. We can then use a different account for updates etc.. BTW, I've just set up Virtual Box and downloaded a couple of kiosk distros. I think the first was Webkiosk. It seemed to work OK. They want $200US to configure it for us. Maybe we can try it in the other machine for a while on Friday and see if we can get by without any changes. The other one is Pynx|Kiosk. I'll look at that one after I get back in a couple of hours. Any suggestions for others to look at? I'll be at tomorrows meeting and ask again there. > All the best, > Robert Later Mike _______________________________________________ Roundtable mailing list Roundtable@muug.mb.ca <mailto:Roundtable@muug.mb.ca> http://www.muug.mb.ca/mailman/listinfo/roundtable
Mike Pfaiffer wrote:
The CLL is setting up a public access machine in the next couple of weeks. It is installed with Mint 8 (a multimedia Ubuntu fork). I would like to set up a couple of init scripts. The first will delete the public account home directory and copy a "clean" version in its place each time the computer starts. The second will shut down the computer after half an hour of use.
I haven't touched on cron since university 20 years ago and I've never written an init script. Having written a few shell scripts I know the copy script should be very simple. I'm not sure how to set up the timer script or make them run on start up. Would anybody be able to fire off some quick directions?
This may be a "foot in the door" situation.
Later Mike
Roundtable mailing list Roundtable@muug.mb.ca http://www.muug.mb.ca/mailman/listinfo/roundtable
A simple addition to root's crontab should allow you to reboot the machine every 30 minutes without any problem. You could also give the user a warning message if you wanted to with notify-send .. see http://www.linuxjournal.com/content/tech-tip-get-notifications-your-scripts-... for reference.. or the september issue of LJ :)
All the best, Robert Keizer
Robert Keizer wrote:
Mike Pfaiffer wrote:
The CLL is setting up a public access machine in the next couple
of weeks. It is installed with Mint 8 (a multimedia Ubuntu fork). I would like to set up a couple of init scripts. The first will delete the public account home directory and copy a "clean" version in its place each time the computer starts. The second will shut down the computer after half an hour of use.
I haven't touched on cron since university 20 years ago and I've
never written an init script. Having written a few shell scripts I know the copy script should be very simple. I'm not sure how to set up the timer script or make them run on start up. Would anybody be able to fire off some quick directions?
This may be a "foot in the door" situation. Later Mike
Roundtable mailing list Roundtable@muug.mb.ca http://www.muug.mb.ca/mailman/listinfo/roundtable
A simple addition to root's crontab should allow you to reboot the machine every 30 minutes without any problem. You could also give the user a warning message if you wanted to with notify-send .. see http://www.linuxjournal.com/content/tech-tip-get-notifications-your-scripts-... for reference.. or the september issue of LJ :)
I'll check out the link this afternoon. I like the idea of notification. Particularly if it's done through a pop-up dialogue box.
As to rebooting every 30 minutes, I was thinking about that earlier. I think it would be best to halt after 30 minutes of usage rather than every 30 minutes. Suppose someone starts up at say 1:29. They would only have one minute before shut down. If it was after 30 minutes of use they would have until 1:59.
All the best, Robert Keizer
Later Mike
On December 7, 2009 12:46:51 pm Mike Pfaiffer wrote:
As to rebooting every 30 minutes, I was thinking about that earlier. I think it would be best to halt after 30 minutes of usage rather than every 30 minutes.
Does this system have a login dialog? Perhaps you could put a command in the XDM or KDM Xstartup file to kill the session after 30 minutes. "shutdown r +30" would do, but killing all of the guest user ID's processes ought to be enough.
Glen Ditchfield wrote:
On December 7, 2009 12:46:51 pm Mike Pfaiffer wrote:
As to rebooting every 30 minutes, I was thinking about that earlier. I think it would be best to halt after 30 minutes of usage rather than every 30 minutes.
Does this system have a login dialog? Perhaps you could put a command in the XDM or KDM Xstartup file to kill the session after 30 minutes. "shutdown r +30" would do, but killing all of the guest user ID's processes ought to be enough.
I was thinking about a login dialogue earlier. There are both plus and minuses to it. The plus is we can directly go to the privileged account to do the updates. The minus is the users (some of which are not too bright) might get confused.
The issue of the halt versus the logout is one which is important. I've been thinking about it all evening. If it's a logout then it is potentially less harmful to the hardware. If it's a halt the benefits are the non-privileged account gets recreated on start-up and the message to the user is "get out of the chair and let someone else have a chance". Before the machine this one is replacing was stolen, we had up to five people waiting for two spots. A halt may help move things along a little faster. Particularly if someone is watching...
It looks like Adam has something to say as a reply to this message. I'll check it out.
Later Mike
On a side note, you may want it to shutdown instead of rebooting. It might be annoying for users to sit down infront of the computer and have it reboot 5 minutes after starting to use it. Just an idea.
-Montana Blog and Aggregation Site: http://montanaquiring.info iPhone/Touch Apps I have bought: http://appshopper.com/feed/user/antikx/myapps
On Mon, Dec 7, 2009 at 8:45 PM, Glen Ditchfield GJDitchfield@acm.orgwrote:
On December 7, 2009 12:46:51 pm Mike Pfaiffer wrote:
As to rebooting every 30 minutes, I was thinking about that earlier. I think it would be best to halt after 30 minutes of usage rather than every 30 minutes.
Does this system have a login dialog? Perhaps you could put a command in the XDM or KDM Xstartup file to kill the session after 30 minutes. "shutdown r +30" would do, but killing all of the guest user ID's processes ought to be enough. _______________________________________________ Roundtable mailing list Roundtable@muug.mb.ca http://www.muug.mb.ca/mailman/listinfo/roundtable
On December 7, 2009 08:45:40 pm Glen Ditchfield wrote:
Does this system have a login dialog? Perhaps you could put a command in the XDM or KDM Xstartup file to kill the session after 30 minutes. "shutdown r +30" would do, but killing all of the guest user ID's processes ought to be enough.
On December 7, 2009 09:06:19 pm Adam Thompson wrote:
Actually... That's an excellent suggestion. Except: the last command in a .xinitrc or .xsession file must stay runningfor the duration of the X session. Normally, that command is "kdeinit" or "gnome-session", or historically, the window manager executable i.e. "mwm" or "twm" or whatever.
I wasn't thinking of changing .xinitrc. I was thinking of /etc/kde4/kdm/Xstartup and /etc/X11/xdm/Xstartup, which "man xdm" says run as root before the user logs in. If you wanted to run "shutdown" from there, you wouldn't have to play any sudo games.
The next trick is to cancel the shutdown if the user logs out, which might take some work in the Xreset file. Xstartup could create a flag file somewhere, and launch a killer script. Xreset would remove the flag file. The killer would check for the flag before killing anything. If your window manager lets users start parallel sessions, the scripts will have to be more clever.
You'll want to wipe the home directory, too, and put in a few minutes of sleep to encourage the current user to move on.