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.

I could not find any relatively simple way to log out of a public use Mac quickly with many tabs open and unsaved document in the background without resorting to sudo shutdown -h now.

The reason I ask is that sometimes a user will have his/her account logged into the iMacs here at school and they would try to log off and then leave, thinking it has completed but the process is interrupted by Safari and Office apps, leaving their account, mounts, and websites still accessible to the next person who sits down.

Obviously a shortcut string would be nice instead of posting a note telling the person to type arcane things in a terminal. For example, just having them try to find Terminal.app is going to be a chore.

This doesn't seem to make sense because the user can just quit each app and click a few dialog boxes but unlike you and I to whom repeatedly pounding Command-Q while hitting the spacebar and D keys are probably second nature.

share|improve this question
2  
Can somebody please answer this question for logging out, not shutting down? For some reason everything is hung: I can mouse around but cannot type or click. I tried to log out from the command line but the lack of save cancelled it for me. I cannot reboot as there are other users with unsaved work that I don't want to force out. –  Michael Dec 10 '13 at 3:24

5 Answers 5

up vote 4 down vote accepted

At my college, they had an app in the Dock whose icon was a white square with LOG OUT in big red letters. It ran a script (put together with appify or similar) that killed all running apps and logged the user off. This also helped with people who didn't know the Mac and didn't look in the Apple menu for the logout menu item.

share|improve this answer

You should create an AppleScript application, saved to the Desktop or other prominent location, that says

  do shell script "sudo shutdown -h now" with administrator privileges

The user double-clicks the shutdown script, gets a dialog box prompting for the password, and if it is correct, the shutdown proceeds. Note that this only works for accounts with administrator privileges.

share|improve this answer

There's also the shortcut Command+Shift+Option+Q to log out without confirmation, but it doesn't help when you have unsaved documents pre-10.7; it just avoids needing to hit Command+Q repeatedly. However, with Lion's Resume feature, this works as intended - leaving unsaved documents for the next time you log in.

share|improve this answer

This could easily be accomplished with Automator. On firing up Automator, select "Application." Take the command sudo shutdown -h now and put it into a "Run Shell Script" automator action. Save it as an application and stick it in the Dock or right in the middle of the desktop. For added effect, do an image search for an appropriate icon that you could add (using your new application's information window). Maybe the classic I/O button or something, like these.

share|improve this answer
    
The sudo command requires an administrator password, and thus won't work embedded in a Run Shell Script action. An AppleScript could prompt an administrative user for a password when running the command, but a non-administrator couldn't do it, and a shell script can't setuid. Now if you wanted to write a c program... –  Daniel Lawson Mar 6 '12 at 2:22
    
Very true. At home sick today, so I'm not thinking clearly I suppose and missed that. The spirit is the same, though, as this can easily be accomplished without a ton of coding, etc., and can easily be deployed to all networked machines. –  soxman Mar 6 '12 at 3:16
    
Yes, if one thinks it's a good idea to let non-administrative users force machine shutdown regardless of what other users are currently logged in. Of course they already have that option even more abruptly if they have physical access to the power button. Or the plug. Or the circuit breaker. –  Daniel Lawson Mar 6 '12 at 3:20

You can use a third party program like Power Manager to automatically log out inactive users. Power Manager will quit any running applications and will deal with applications that attempt to block the process with sheets or dialogs.

Power Manager - automatically log out inactive user

Disclosure: I work for DssW, the makers of Power Manager.

share|improve this answer

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.