macOS Sierra 10.12.2 root 无法写入 /usr/sbin

Sob*_*bra 3 root terminal permissions macos

谁能解释一下为什么?

# whoami
root

# ls -ld /usr/sbin
drwxr-xr-x  246 root  wheel  8364 Jan  3 14:36 /usr/sbin

# pwd
/

# touch test-file
# ls -ltr test-file
-rw-r--r--  1 root  wheel  0 Jan 10 00:27 test-file

# cp test-file /usr/sbin
cp: /usr/sbin/test-file: Operation not permitted

# ls -ld@ /usr/sbin
drwxr-xr-x  246 root  wheel  8364 Jan  3 14:36 /usr/sbin
Run Code Online (Sandbox Code Playgroud)

gre*_*449 5

这是MACOS系统完整性保护(SIP),其防止甚至根从改变事物中/System/usr/bin/sbin和预安装的应用。

一个例外/usr/usr/local可以写的。

有关此问题的 Apple 支持文档在此处