Kodama's home / tips.

ファイルやディレクトリのモ−ドは OK?

書き込み許可のままになっているなどの危険なファイルをしらべる方法. 以下の様にして書き込み許可のままになっているファイル/ディレクトリ−を探す.
find . -perm -0002 -a \( -type d -o -type f \) -ls
同じ手法で SUID, SGID などが有功になっているファイルなどの確認も行うと良い.

問題があれば, 以下の様にしてモードを変える.
$ ls -l sample.txt
-rw-rw-rw-    1 kodama   users           0  9月  7日  18:03 sample.txt

     書き込み許可のままになっている

$ chmod go-w sample.txt

     モードを修正

$ ls -l sample.txt
-rw-r--r--    1 kodama   users           0  9月  7日  18:03 sample.txt

     確認する

Kodama's home / tips.