File permissions
このページには最新のブラウザ(SharedArrayBuffer対応)が必要です。Chrome、Edge、Firefox、Safariを最新バージョンに更新してください。
誰が何をできるか
- 全てのファイルには、誰が read(読める)、write(書ける)、execute(実行できる)かを表す権限があります。
ls -lは各行の左側にそれらを表示します:
ls -l script.sh
-rwxr-xr-xのようなものが見えます。3文字ごとに読んでください。
フラグを読む
- 10文字は以下の通り:タイプ、次に 所有者、グループ、その他:
- rwx r-x r-x
file owner group others
r= 読める、w= 書ける、x= 実行可能、-= 不可。つまり所有者はこの環境で全てができ、他者は読めて実行できます。
権限を変更する
chmodはchange(変更)とmode(モード)を表します。数字は素早い方法です:r=4, w=2, x=1はグループごとに追加されます。
chmod 755 script.sh
7= 4+2+1 (rwx) は所有者、5= 4+1 (r-x) はグループとその他。755は古典的な「実行可能なプログラム」です。
よくあるミス
chmodはユーザー、グループ、その他に対して読める、書ける、実行できるをセットします。- 実際のシステムでは、
./script.shなどの直接実行には実行権限と適切なインタプリタが必要です。sh script.shは代わりにシェルにファイルを読み込ませるため、スクリプト自体には実行ビットではなく読取り権限が必要です。当シミュレータはモードを表示しますが、スクリプトを実行しません。
探索
File permissions (chmod)
Owner / group / others each get rwx — the octal is just those bits.
難易度 3/5 · 200 コイン + 今日初回達成時の小ボーナス
Make script.sh runnable by giving it permissions 755 with chmod 755 script.sh. The check shows ls -l so you can see the new rwx flags.
難易度 3/5 · 200 コイン + 今日初回達成時の小ボーナス
secret.key holds a private key, so ordinary group members and other users should have no read access. Give it permission 600 with chmod 600 secret.key — owner read+write, group and others nothing.
難易度 3/5 · 200 コイン + 今日初回達成時の小ボーナス
Share report.txt with your project group. The owner needs read and write; the group needs read only; other users need no access. Choose the numeric mode and set it with chmod.