问题
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
回答1:
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
来源:https://stackoverflow.com/questions/37865439/terminal-command-to-change-security-and-privacy-advanced-setting