atoss

Q: How to use Terminal to set the AutoLogout feature?

Hello community!  I've spent the better part of the day trying to use the Terminal app to set the "Log out after X minutes of activity"  option (in System Preferences > Security > Advanced).  I have about 150 iMacs for which this needs to be turned on and I'd like to push out a command with ARD all at once rather than going around to each iMac and clicking the box manually, but I just can't figure it out.

 

I've found the .GlobalPreferences.plist file and have been experimenting with it and altering it.  I've read countless forums and discussions that say that this should be accomplished by editing as such:

sudo defaults write /Library/Preferences/.GlobalPreferences com.apple.securitypref.logoutvalue 1800

I've also read that this only changes the value in the text field and that this value should also be edited:

sudo defaults write /Library/Preferences/.GlobalPreferences com.apple.autologout.AutoLogOutDelay 1800

But this is just not working for me.  I can get the text field to change the number of minutes by using the first command, but no matter what I do, I can't get the actual checkbox to check.  I've even watched carefully what happens to the .GlobalPreferences.plist file as I manually check the box on my test Mac.  It would appear that the exact same changes take place in the .plist file when I check it manually as when I change the values through Terminal.  The only discernible difference, as far as I can tell, is that doing it manually actually checks the box and doing it through Terminal does nothing.

 

I'm running 10.10.2 on my test Mac, since Yosemite will be deployed to these iMacs soon.  However, I was also not able to make these commands work on any of the iMacs which are currently on 10.9.5 either.

 

What am I missing?  Please help!

Mac mini, OS X Server, OS X 10.9.4 with Server 3.1.2 running on a Mac mini

Posted on Feb 10, 2015 2:21 PM

Close

Q: How to use Terminal to set the AutoLogout feature?

  • All replies
  • Helpful answers

  • by derbystar1630,Solvedanswer

    derbystar1630 derbystar1630 Mar 1, 2016 9:04 AM in response to atoss
    Level 1 (18 points)
    Mac OS X
    Mar 1, 2016 9:04 AM in response to atoss

    Hi, I had a problem with this too. You're missing a crucial bit of info before setting the value to 1800. Instead of:

     

    sudo defaults write /Library/Preferences/.GlobalPreferences com.apple.autologout.AutologoutDelay 1800


    It should be:


    defaults write /Library/Preferences/.GlobalPreferences com.apple.autologout.AutologoutDelay -int 1800

  • by atoss,

    atoss atoss Mar 1, 2016 9:19 AM in response to derbystar1630
    Level 1 (12 points)
    Mar 1, 2016 9:19 AM in response to derbystar1630

    Wow.  It took more than a year for someone to respond to that!  Sure enough, that worked!  I sure wish I figured that out last year.

     

    Thanks!