Policy to turn off "Log out after X minutes of inactivity

Randydid
Contributor II

Hello all,

I somehow missed this setting in my last image build and it is set to 60 minutes. I have poked around in the com.apple.alf.plist but it does not appear to be disabled there and looking at other plists, it I cannot seem to find it. I can script a defaults write string to change a 1 to a 0 or whatever but I just need to find where this lives.

TIA,

/randy

10 REPLIES 10

Aaron
Contributor II

I haven't tested it, but it'll be:

defaults write /Library/Preferences/.GlobalPreferences com.apple.autologout.AutoLogOutDelay" -int 0

mm2270
Legendary Contributor III

Hi.

I would recommend looking at a Configuration Profile or MCX to do this, even if only needing to set it once. I'm almost certain the option exists in one of those methods to set this.

But just so you know, you may not have been finding it, because its stored inside a hidden plist at /Library/Preferences/.GlobalPreferences.plist
The key in the plist is com.apple.autologout.AutoLogOutDelay
No, that's not a typo. The key in the .GlobalPreferences.plist is in that reverse url style format.
You can set it in a script for testing purposes like

sudo defaults write /Library/Preferences/.GlobalPreferences.plist com.apple.autologout.AutoLogOutDelay -int 3600

That would set it to 60 minutes of activity.
Change the integer to 0 to disable it.

Randydid
Contributor II

Thanks. Testing now.

/randy

CapU
Contributor III

This was working.....before the 10.10.4 update. Does anyone have an updated script or happen to know which plist I should edit?

Boughen
New Contributor

Hello, we have suddenly started seeing this on macs running 10.10.4 in all our sites, but not all of our managed macs. The macs go to screen saver and then logout after 60 mins of no activity.

I have found that amending the following does not seem to work on 10.10.4

sudo defaults write /Library/Preferences/.GlobalPreferences com.apple.autologout.AutoLogOutDelay -int 0

Any tips?

Cheers, Neil

Brad_G
Contributor II

Check to see if there are any Configuration Profiles pushed to those clients. If there are, check to see if Login Window is configured. If so, under Options there is a setting "Log out users after:" that may be checked. There was some reference back that this got enabled by default in a JSS update. I just helped an admin with this yesterday.

Boughen
New Contributor

@Brad_G Thank you!

We seem to have a setting silently added to two of our configuration profiles, adding or amending "Login Window” that had the setting for “Log out user after x minutes”

Thank you for your help, I am going edit then re-distrubute the Profiles and will feedback the results.

Neil

flyboy
Contributor

@Boughen, instead of setting com.apple.autologout.AutoLogOutDelay to 0, delete the key. I've got that working on 10.10.5

sudo defaults delete /Library/Preferences/.GlobalPreferences.plist com.apple.autologout.AutoLogOutDelay

jleomcdo
Contributor

I just started having this same issue, with users being logged out after x minutes. After reading Brad_G's post, I did find a Configuration Profile with the Login Windows set to log out user.

The reason I'm posting this, is that I know that I didn't have that configured before and haven't touched that Config. Profile for a long time. But then I remembered that I recently upgraded the JSS from 9.7 to 9.81.

Not sure if this is a bug or what, but I wanted to point this out.

Thanks again to Brad!

znilsson
Contributor II

I'm trying to do this as a script pushed out as a policy, since the config profile item does not work to disable the auto logout feature. So this script:

defaults delete /Library/Preferences/.GlobalPreferences.plist com.apple.autologout.AutoLogOutDelay

results in:

Domain (/Library/Preferences/.GlobalPreferences.plist) not found.

on every Mac I have it scoped to except my own mac and my test mac, for whatever reason. Is it because it's hidden? Or something else?

EDIT - basically ignore this. It looks like this result is saying it can't find that specific key inside the plist, which is the result we expect if the feature has already been disabled. I was just thrown by the wordage, as it makes it seem like it can't find the plist file at all.