terminal command to change Security and Privacy Advanced Setting

爱⌒轻易说出口 提交于 2020-06-26 14:36:35

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!