▼すべてを開く。
▲すべてを閉じる。
$ ls -l -rwxrwxrwx 1 masa users 256 5月 19 19:00 file
$ chmod g=w file
chmodコマンドで、グループを示す「g」に特定の権限だけの設定を示す「=」そして書き込み「w」対象ファイル名「file」を指定すると、グループのファイル「file」に対するアクセス権が書き込みだけに設定される。
コマンド実行結果をリストで見る$ ls -l -rwx-w-rwx 1 masa users 256 5月 19 19:00 file
$ ls -l -rwxrwxrwx 1 masa users 256 5月 19 19:00 file
$ chmod o=w file
chmodコマンドで、その他のグループを示す「o」に特定の権限だけの設定を示す「=」そして書き込み「w」対象ファイル名「file」を指定すると、その他のグループのファイル「file」に対するアクセス権が書き込みだけに設定される。
コマンド実行結果をリストで見る$ ls -l -rwxrwx-w- 1 masa users 256 5月 19 19:00 file
$ ls -l drwxr-xr-x 2 masa users 4096 5月 20 17:50 dir1
$ chmod g+w dir1
chmodコマンドで、グループを表す「g」に書き込み権の付加を表す「+w」対象ディレクトリ名「dir1」を指定すると、ディレクトリ「dir1」にグループの書き込み許可が設定される。
lsコマンドで実行結果を見る$ ls -l drwxrwxr-x 2 masa users 4096 5月 20 17:50 dir1
$ ls -l drwxr-xr-x 2 masa users 4096 5月 20 17:50 dir1
$ chmod o+w dir1
chmodコマンドで、その他のグループを表す「o」に書き込み権の付加を表す「+w」対象ディレクトリ名「dir1」を指定すると、ディレクトリ「dir1」にその他のグループの書き込み許可が設定される。
lsコマンドで実行結果を見る$ ls -l drwxr-xrwx 2 masa users 4096 5月 20 17:50 dir1
$ ls -l dr-xr-xr-x 2 masa users 4096 5月 20 17:50 dir1
$ chmod u+w dir1
chmodコマンドで、所有者を表す「u」に書き込み権の付加を表す「+w」対象ディレクトリ名「dir1」を指定すると、ディレクトリ「dir1」に所有者の書き込み許可が設定される。
lsコマンドで実行結果を見る$ ls -l drwxr-xr-x 2 masa users 4096 5月 20 17:50 dir1
ディレクトリの所有者本人がコマンドを実行する場合「u」を省略することができる。
$ chmod +w dir1
$ ls -l dr-xr-xr-x 2 masa users 4096 5月 20 17:50 dir1
$ chmod a+w dir1
chmodコマンドで、全員を表す「a」に書き込み権の付加を表す「+w」対象ディレクトリ名「dir1」を指定すると、ディレクトリ「dir1」に全員の書き込み許可が設定される。
lsコマンドで実行結果を見る$ ls -l drwxrwxrwx 2 masa users 4096 5月 20 17:50 dir1
$ ls -l -rwxr--r-- 1 masa users 268 6月 3 21:48 myfile1
$ chmod g+w myfile1
chmodコマンドで、グループを示す「g」に書き込み権の付加を表す「+w」対象ファイル名「myfile1」を指定すると、ファイル「myfile1」にグループの書き込み許可が設定される。この例では、ユーザ「masa」はグループ「users」に属しているので、このグループに属するユーザがファイルを書くことができるようになる。
lsコマンドで実行結果を見る$ ls -l -rwxrw-r-- 1 masa users 268 6月 3 21:48 myfile1
$ ls -l -rwxrw-r-- 1 masa users 268 6月 3 21:48 myfile1
$ chmod o+w myfile1
chmodコマンドで、その他のグループを示す「o」に書き込み権の付加を表す「+w」対象ファイル名「myfile1」を指定すると、ファイル「myfile1」にその他のグループの書き込み許可が設定される。この例では、ユーザ「masa」はグループ「users」に属しているので、このグループに属するユーザ以外のユーザもファイルを書き込むことができるようになる。
lsコマンドで実行結果を見る$ ls -l -rwxrw-rw- 1 masa users 268 6月 3 21:48 myfile1
$ ls -l -r-xr--r-- 1 masa users 268 6月 3 21:48 myfile1
$ chmod u+w myfile1
chmodコマンドで、ファイルの所有者を示す「u」に書き込み権の付加を表す「+w」対象ファイル名「myfile1」を指定すると、ファイル「myfile1」に所有者の書き込み許可が設定される。
lsコマンドで実行結果を見る$ ls -l -rwxr--r-- 1 masa users 268 6月 3 21:48 myfile1
自らが所有するファイルを変更する場合、ファイルの所有者を示す「u」を省略して書き込み権の付加を表す「+w」だけでもよい。
$ chmod +w myfile1
$ ls -l -r--r--r-- 1 masa users 268 6月 3 21:48 myfile1
$ chmod a+w myfile1
chmodコマンドで、すべてのユーザを示す「a」に読み込み権の付加を表す「+w」対象ファイル名「myfile1」を指定すると、ファイル「myfile1」にすべてのユーザの書き込み許可が設定される。
lsコマンドで実行結果を見る$ ls -l -rw-rw-rw- 1 masa users 268 6月 3 21:48 myfile1
$ ls -l -rwxrwxrwx 1 masa users 256 5月 19 19:00 file
$ chmod u=w file
chmodコマンドで、ファイルの所有者を示す「u」に特定の権限だけの設定を示す「=」そして書き込み「w」対象ファイル名「file」を指定すると、所有者のファイル「file」に対するアクセス権が書き込みだけに設定される。
コマンド実行結果をリストで見る$ ls -l --w-rwxrwx 1 masa users 256 5月 19 19:00 file
$ ls -l -rwxrwxrwx 1 masa users 256 5月 19 19:00 file
$ chmod a=w file
chmodコマンドで、その他のグループを示す「a」に特定の権限だけの設定を示す「=」そして書き込み「w」対象ファイル名「file」を指定すると、その他のグループのファイル「file」に対するアクセス権が書き込みだけに設定される。
コマンド実行結果をリストで見る$ ls -l --w--w--w- 1 masa users 256 5月 19 19:00 file