所有者、permission、umaskと特殊bit1 / 3
通常の権限
権限はowner・group・otherへ分かれ、r=4、w=2、x=1を合計する。fileでは読取り、内容の変更、実行へ使う。directoryではrが名前の一覧、wが項目の追加・削除、xが検索・通過へ関わる。fileの削除は主に親directoryのw/xなどに依存し、file自体のwだけで決まらない。
report.txtの権限を指定する例である。
chmod 640 report.txt
| 対象 | 権限 |
|---|---|
| owner | 読取りと書込み(rw) |
| group | 読取り(r) |
| other | 権限なし |
追加・削除や所有者変更の指定は、それぞれ作用する対象が異なる。
| 指定 | 操作 |
|---|---|
| chmod g+w report.txt | groupの書込み権限を追加 |
| chmod o-rwx | otherの三権限を除く構文。対象ファイルも指定する |
| chown learner:editors report.txt | ownerとgroupを変更 |
| chgrp editors report.txt | groupを変更 |