OS X El Capitanのrootless(System Integrity Protection)について
rootlessとは
System Integrity Protection(SIP)。通称rootlessはシステムの重要な部分に関してroot権限ですら変更できないような 領域を作ることによりシステムを保護する機能。デフォルトでは有効となっているため、これを無効化しないかぎりユーザによるシステム領域の変更は認められない。
アクセスが制限されるディレクトリーは以下となる
/System
/bin
/usr
/sbin
サードパーティー製のアプリケーションやインストーラーについては今後以下に書き込む
/Applications
/Library
/usr/local
保護されているファイルの確認
ターミナルで以下のコマンドを叩くとrootlessによって保護されているファイル、デイレクトリの一覧が表示される
cat /System/Library/Sandbox/rootless.conf
ディレクトリ内のファイルがrootlessの制限対象であるかどうかはlsコマンドの「O」オプションで確認することができる
グループ名の右横に「restricted」とあるディレクトリはrootlessの対象であり、rootであっても書き込みできない
sh-3.2# ls -lO
total 8
drwxr-xr-x 5 root wheel restricted 170 8 2 2015 X11
lrwxr-xr-x 1 root wheel restricted 3 4 4 17:29 X11R6 -> X11
drwxr-xr-x 3 root wheel restricted 102 2 27 16:11 adic
drwxr-xr-x 1055 root wheel restricted 35870 6 6 18:42 bin
drwxr-xr-x 266 root wheel restricted 9044 6 6 18:42 lib
rootlessの操作
Rootlessを操作する場合はcsrutilコマンドにて操作を行う。
ステータス確認
pc086:~ hogehoge$ csrutil status
System Integrity Protection status: enabled.
解除方法
必要な作業はリカバリーモードのターミナルで「csrutil disable」と入力すること。
- Command+Rを押しながらMACを再起動でリカバリーモード起動
- トップメニューから「ユーティリティー>ターミナル」と選んでターミナルを起動
- csrutil disableというコマンドを実行
- MACを再起動
- ターミナルで「csrutil status」というコマンドを実行
rootless変更が完了していれば「System Integrity Protection status: disabled.」と表示されます。
参考URL
- WWDC presentation on "Secutiry and Your Apps"
https://developer.apple.com/videos/play/wwdc2015/706/ - OS X El Capitanのセキュリティレイヤーの概念図も用いて詳しく解説されている
http://rcmdnk.github.io/blog/2015/10/10/computer-mac/