Log out other users when a new one logs in

kunkelb
New Contributor II

Morning all, hope everyone had a great holiday.

In my school, we have lab and cart machines -- no one to one transition yet -- and initially, we were having the problem of students not logging out (User A) and forcing the next user (User B) to hard power off the machine and restart it to use it. We enabled Fast User Switching, which alleviated THAT problem, but now when a student wants to shut down the machine, it needs an administrative account and password to log out all of the other users that are still logged in. Obviously, this is not the best situation.

Is there a way to, when User B logs in using Fast User Switching, to force User A to log out?

Thanks in advance for any help!

4 REPLIES 4

McAwesome
Valued Contributor

When in use, are these pulled off the cart by each student or are they set up and left on a desk/table/wookie/whatever? If the latter, there's a pkg you can build that can force reboot after an idle time you set. That could help alleviate it.

davidacland
Honored Contributor II
Honored Contributor II

I don't think there would be a straightforward way to do that but you could add a self service button that runs a shutdown or reboot.

CypherCookie
Contributor

We had a similar problem. In the end we got the workshop assistants admin rights to do this. Alternatively, you can put an auto power off script in place to power manage the Mac's without ever needing anyone to turn them off.

This should get around your issue of needing an admin account to turn the mac off. The downside is that if the machine is logged in and has active applications such as office, that could cause the Mac to stay powered on. You will need to include a kill command incase anything is running.

Alternatively get your users to log off.

mm2270
Legendary Contributor III

There's nothing built in to OS X that can do what you're looking for.

It might be possible to hack together a solution using a LaunchDaemon/script process that would look for more than one "consoled" user account at once, determine which user is actually controlling the machine and kill the other session(s), but it would really be a hack, and its hard to say if it would eventually destabilize the systems doing this long term, since there's no graceful way to log out an account other than being logged into the account and then logging out of it. There's a lot of stuff going on in the background when you do "logout" from the Apple menu that would be almost impossible to recreate with a scripted process.

I think the best suggestion is from @davidacland to set up a Self Service policy or two, permanently scoped to these Macs that the students can run to force reboot or force shut down the Mac. In fact, it should be easy to make it a single policy they run that pops up a simple dialog with buttons or radio buttons to choose between "shut down" and "reboot" so they can decide which one they want/need to do at the time.