$ chmod 許可 対象ファイル

許可の部分には誰、操作、何を指定します。

「誰」の部分には
u(user:所有者)
g(group:グループ)
o(others:その他)
a(all:全員)
を組み合わせて指定。

「操作」の部分には
+(許可を加える)
-(許可を取り除く)
=(設定をリセットしてから、許可を設定する)
のいずれかを指定。
「何」の部分では
r(read:読取り)
w(write:書込み)
x(execute:実行)
を組み合わせて指定。


$ chmod ug-w,a+r test.txt
所有者とグループから書込み許可を除いて、全員に読取り許可を与える。

$ chmod a=x test.txt
許可情報をすべてリセットしてから全員に実行許可を与える。
数字を用いた許可情報の設定

400 所有者の読取り
200 所有者の書込み
100 所有者の実行
40 グループの読取り
20 グループの書込み
10 グループの実行
4 その他の読取り
2 その他の書込み
1 その他の実行


所有者にだけw,r,xの許可を与える
$ chmod 700 test.txt

400 所有者の読取り
200 所有者の書込み
+ 100 所有者の実行
700

全員にrの許可だけを与える
$ chmod 444 test.txt

400 所有者の読取り
40 グループの読取り
+ 4 その他の読取り
444

$ chmod 000 test.txt (許可なし)
$ chmod 111 test.txt (実行許可)
$ chmod 222 test.txt (書込許可)
$ chmod 333 test.txt (書込と実行許可)
$ chmod 444 test.txt (読取り許可)
$ chmod 555 test.txt (読取りと実行許可)
$ chmod 666 test.txt (読取りと書込許可)
$ chmod 777 test.txt (読取りと書込と実行許可)

2024年4月
« 4月    
 123456
78910111213
14151617181920
21222324252627
282930  

カテゴリー

広告

現在の住まい、将来はVPSへ引越します。 ロリポップの上位版です。

広告

広告

最近のコメント

    広告

    Railsを動かす予定のVPS。無料キャンペーン中。

    広告