LoginSignup
3
2

More than 1 year has passed since last update.

linuxのファイルのパーミッション4桁目

Posted at

linuxのファイルのパーミッション
0644とかの4桁目のことをよく忘れるのでメモ。

3桁目まで

100 の位 10 の位 1 の位
オーナー グループ 全員
読込権限 書込権限 実行権限
4 2 1

4桁目

4桁目は特殊な権限設定

setuid setgid sticky bit
4 2 1

0 : とくになにもなし
1 : スティッキービット: 所有者以外消せないけど誰でも書き込めるって奴。 /tmpとかのディレクトリに初期設定されてる。ファイルに付与したら何も起きない。
2 : SGID: 付けた場合、そのファイルの所属グループの権限で動くようになる。
4 : SUID: 付けた場合、そのファイルの所有者の権限で動くようになる。

2が一番使う?

例えば
person-aとperson-bで更新したいので
同じwebグループに所属させて・・・

# groupadd web
# usermod -a -G web person-a
# usermod -a -G web person-b
# chmod 2775 /var/www/html/contents/

contents/ 以下に作成されるファイル/ディレクトリのグループは、すべてcontents/ と同じ「web」になる

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2