Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

As part of a kiosk system, I have set up a Guest account on a Mac OS X Snow Leopard computer. This account is cleared every time someone logs off the computer. However, plenty of people don't. Is there any way that I can automatically log out this guest account after a period of inactivity?

I tried using the security preferences pane, but that just causes the confirm logout dialog to show up.

I have hacked around the /System/Library/User Templates/ folder, so I can set the screensaver, desktop background, &c. If something like ScriptSaver can solve my problem, I will gladly use it.

share|improve this question
    
Would there really be harm in just setting a daily shut down and power up at the end/beginning of the day? –  bmike Jul 20 '11 at 3:16
1  
@bmike I do want it to be after a period of inactivity, not on a scheduled basis. Users can't be trusted to log out when they're done... –  Soumya Jul 20 '11 at 3:26
    
Fair enough - I'll see if I can gin up a launchd login item to set the automatic timeout. It sure seems like it should be possible, i just will have to re-examine how the creation of the guest folder happens each log in. –  bmike Jul 20 '11 at 3:29
    
@bmike I just want a simple script, or a few lines of code, that can force logout of a guest account. Timing is not an issue. There is scriptsaver, sleepwatcher, et al. for that. If you could whip up something, or point me in the right direction, it would be extremely helpful. –  Soumya Jul 20 '11 at 3:33

3 Answers 3

up vote 2 down vote accepted

Maybe you could consider using SleepWatcher instead of the Security.prefPane; it´s a unix utility you could use to force a logout (or anything else via AppleScript) after a certain period of inactivity.

share|improve this answer
    
I could use ScriptSaver, too. The problem is I don't have a command to force the Guest account to logout. If you have one, it would be helpful... –  Soumya Jul 18 '11 at 14:56
1  
It is almost a catch 22 - sudo killall loginwindow will force a log out no matter what, but you need to lock out terminal so that smart users will not try to sudo - I suppose adding killall loginwindow to the sudo whitelist isn't any worse than letting the user log out. You might also get Faronics deep freeze to ensure everything is perfectly frozen each reboot. –  bmike Jul 20 '11 at 3:40
    
@Soumya92: You should maybe use AppleScript´s ` tell application "loginwindow" to «event aevtrlgo» ` instead, so it only logs out the guest user, not every user. –  Asmus Jul 20 '11 at 10:13

You can use a commercial product called Power Manager to log out a user after a period of inactivity.

Power Manager will warn the user before starting the log out. During log out any open applications will be quit; applications attempting to block log out will be force quit after a short delay.

Power Manager for Mac OS X

Disclosure: I work for the company who make Power Manager.

share|improve this answer
    
I could also write an app to do just that instead of the bevy of features that Power Manager provides. No doubt it is a powerful tool, but I can't justify purchasing it solely for this purpose. It is just a kiosk computer. I can't find a good command or code sample to log out the guest account –  Soumya Jul 20 '11 at 2:43
    
Great answer and disclosure. How is this different than the built in controls? Does it run at boot rather than at the user level? –  bmike Jul 20 '11 at 3:42
    
Power Manager has a number of advantages. Power Manager will show a warning, it will ensure log out takes place even where an application would traditionally block log out. The event can be conditional based on running applications or the result of an external script. See the documentation for specifics: dssw.co.uk/powermanager/guide/v4 –  Graham Miln Jul 20 '11 at 4:12

Haven't tried this with a aGuest account, but no reason it shouldn't work there.

In

System Preferences > Security > General

is a checkbox labeled "Log out after XX minutes of inactivity"

Here set your desired minute amount and let it do the magic!

share|improve this answer
1  
I did. As I mentioned, that just shows me the Confirm Logout box. The reason it won't work on a Guest account is because logging out of a guest account deletes the session data, so a confirmation is required. –  Soumya Jul 18 '11 at 6:03
    
Additionally, that setting applies to ALL users, not just the guest account. –  Damian Mar 13 '13 at 20:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.