chmodコマンド
スポンサードリンク
【説明】
cdmodコマンドは、指定したファイルのアクセス権を変更する際に使用します。ただしchmodコマンドはシンボリックリンクのファイルやディレクトリに対してはアクセス権の変更は行わないので注意が必要です。「-R」オプションを使用してディレクトリ配下のすべてのアクセス権を変更する際もシンボリックリンクに対してのアクセス権変更は行われません。
【構文】
cd [ オプション] [ モード ] [ ディレクトリ/ファイル ]
例 test.txtの所有者のみが読み書き可能で、その他のユーザは読み込みのみ可能(数値モード)
[root@localhost test]# ls -l
合計 0
-r--r--r-- 1 root root 0 6月 12 07:38 test.txt [root@localhost test]#
[root@localhost test]# chmod 644 test.txt [root@localhost test]#
[root@localhost test]# ls -l
合計 0
-rw-r--r-- 1 root root 0 6月 12 07:38 test.txt |
→lsコマンドの詳細を見る
例 所有者のみが読み書き可能で、その他のユーザは読み込みのみ可能(アルファベットモード)
[root@localhost test]# ls -l
合計 0
-r--r--r-- 1 root root 0 6月 12 07:38 test.txt
[root@localhost test]#
[root@localhost test]# chmod u=rw,g=r,o=r test.txt
[root@localhost test]#
[root@localhost test]# ls -l
合計 0
-rw-r--r-- 1 root root 0 6月 12 07:38 test.txt
|
|
|