简体   繁体   中英

terminal command to change Security and Privacy Advanced Setting

http://cdn.osxdaily.com/wp-content/uploads/2013/03/automatic-log-out-mac.jpg (picture of the setting I am trying to check)

I am trying to figure out how to use a terminal command to check that setting and time limit. I have to use the terminal because I am trying to get it into my image so I can deploy it.

Mac El Capitan System Preferences > Security & Privacy > Advanced > "Log out after 90 minutes of inactivity.

Question: How do I change that setting from Terminal.

Thanks in advance

The setting is in this file: /Library/Preferences/.GlobalPreferences

It is (weirdly) controlled by two keys:

com.apple.autologout.AutoLogOutDelay

com.apple.securitypref.logoutvalue

You have to set both for it to appear correctly in the System Preferences (which you also have to quit and relaunch to get it to pick up updated settings).

To view the current setting (if there is one):

defaults read /Library/Preferences/.GlobalPreferences com.apple.autologout.AutoLogOutDelay
defaults read /Library/Preferences/.GlobalPreferences com.apple.securitypref.logoutvalue

To change the value to one hour (3600 seconds):

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM