ディレクトリとファイルパーミッション
こいつもちょっと躓きやすい。概念が分かってしまえばなんて事ないのだが、説明が貧弱過ぎるから、カット&トライしてみるしかないのだ。だから私が試してみて出来たことをここに記しておくので、ここを読んだ人は近道を通って欲しい。
| administrator/backups/ | Unwriteable |
| administrator/components/ | Unwriteable |
| administrator/modules/ | Unwriteable |
| administrator/templates/ | Unwriteable |
| cache/ | Unwriteable |
| components/ | Unwriteable |
| images/ | Unwriteable |
| images/banners/ | Unwriteable |
| images/stories/ | Unwriteable |
| language/ | Unwriteable |
| mambots/ | Unwriteable |
| mambots/content/ | Unwriteable |
| mambots/editors/ | Unwriteable |
| mambots/editors-xtd/ | Unwriteable |
| mambots/search/ | Unwriteable |
| mambots/system/ | Unwriteable |
| media/ | Unwriteable |
| modules/ | Unwriteable |
| templates/ | Unwriteable |
見事にパーミッションが制限されていて、書き込みが許可されていない。
この項目だけは、一個ずつパーミッションを見直していかないと駄目っぽい感じだ。
[root@www html]# ls -la
drwxrwxr-x 15 sasapurin apache 4096 4月 7日 20:22 ./
drwxr-xr-x 7 sasapurin apache 4096 4月 7日 11:55 ../
-rw-r–r– 1 sasapurin apache 5851 4月 7日 19:44 .htaccess
-rw-r–r– 1 sasapurin apache 104874 4月 7日 19:37 CHANGELOG.php
-rw-r–r– 1 sasapurin apache 3429 4月 7日 19:37 COPYRIGHT.php
-rw-r–r– 1 sasapurin apache 4376 4月 7日 19:37 INSTALL.php
-rw-r–r– 1 sasapurin apache 17977 4月 7日 19:37 LICENSE.php
drwxr-xr-x 9 sasapurin apache 4096 4月 7日 19:37 administrator/
drwxr-xr-x 2 sasapurin apache 4096 4月 7日 19:37 cache/
drwxr-xr-x 16 sasapurin apache 4096 4月 7日 19:37 components/
-rw-r–r– 1 sasapurin apache 4372 4月 7日 19:37 configuration.php-dist
drwxr-xr-x 2 sasapurin apache 4096 4月 7日 19:37 editor/
-rw-r–r– 1 sasapurin apache 3890 4月 7日 19:37 globals.php
-rw-r–r– 1 sasapurin apache 1041 4月 7日 19:37 globals.php-off
drwxr-xr-x 3 sasapurin apache 12288 4月 7日 19:38 help/
-rw-r–r– 1 sasapurin apache 5867 4月 7日 19:37 htaccess.txt
drwxr-xr-x 6 sasapurin apache 4096 4月 7日 19:38 images/
drwxr-xr-x 12 sasapurin apache 4096 4月 7日 19:38 includes/
-rw-r–r– 1 sasapurin apache 8481 4月 7日 19:37 index.php
-rw-r–r– 1 sasapurin apache 5216 4月 7日 19:37 index2.php
drwxr-xr-x 4 sasapurin apache 4096 4月 7日 19:49 installation/
drwxr-xr-x 2 sasapurin apache 4096 4月 7日 19:38 language/
-rw-r–r– 1 sasapurin apache 710 4月 7日 19:37 mainbody.php
drwxr-xr-x 7 sasapurin apache 4096 4月 7日 19:39 mambots/
drwxr-xr-x 2 sasapurin apache 4096 4月 7日 19:39 media/
drwxr-xr-x 2 sasapurin apache 4096 4月 7日 19:39 modules/
-rw-r–r– 1 sasapurin apache 4929 4月 7日 19:37 offline.php
-rw-r–r– 1 sasapurin apache 2474 4月 7日 19:37 offlinebar.php
-rw-r–r– 1 sasapurin apache 709 4月 7日 19:37 pathway.php
-rw-r–r– 1 sasapurin apache 301 4月 7日 19:37 robots.txt
drwxr-xr-x 5 sasapurin apache 4096 4月 7日 19:39 templates/
しかし一見しただけでオーナー(sasapurin)は書込み権限を持っているが、グループ(apache)に書込み権限が無い事が分かった。
せっかくのSSHでコマンド操作なので、なるだけシンプルに行きたいのだが、全部のファイルに適用する訳にもいかないから、こういう感じでやってみることにした。
[root@ html]# chmod g+w administrator/backups/
[root@ html]# chmod g+w administrator/components/
[root@ html]# chmod g+w administrator/modules/
[root@ html]# chmod g+w administrator/templates/
[root@ html]# chmod g+w cache/
[root@ html]# chmod g+w components/
[root@ html]# chmod g+w images/
[root@ html]# chmod g+w images/banners/
[root@ html]# chmod g+w images/stories/
[root@ html]# chmod g+w images/stories/
[root@ html]# chmod g+w language/
[root@ html]# chmod g+w mambots/
[root@ html]# chmod g+w mambots/content/
[root@ html]# chmod g+w mambots/editors/
[root@ html]# chmod g+w mambots/editors-xtd/
[root@ html]# chmod g+w mambots/search/
[root@ html]# chmod g+w mambots/system/
[root@ html]# chmod g+w media/
[root@ html]# chmod g+w modules/
[root@ html]# chmod g+w templates/
chmodでグループ(g)だけに書込み権限(w)を加える(+)という意味だ。
手間はかかったが、無事に赤い文字が緑に変わって書込み可能となった。
| administrator/backups/ | Writeable |
| administrator/components/ | Writeable |
| administrator/modules/ | Writeable |
| administrator/templates/ | Writeable |
| cache/ | Writeable |
| components/ | Writeable |
| images/ | Writeable |
| images/banners/ | Writeable |
| images/stories/ | Writeable |
| language/ | Writeable |
| mambots/ | Writeable |
| mambots/content/ | Writeable |
| mambots/editors/ | Writeable |
| mambots/editors-xtd/ | Writeable |
| mambots/search/ | Writeable |
| mambots/system/ | Writeable |
| media/ | Writeable |
| modules/ | Writeable |
| templates/ | Writeable |
いちいちパーミッション修正を手作業でやってられるか!という人はこれが役立つかも。意味が分かる人だけ自分の環境に変更して使ってね。
#!/bin/sh
cd /var/www/html
chmod g+w administrator/backups/
chmod g+w administrator/components/
chmod g+w administrator/modules/
chmod g+w administrator/templates/
chmod g+w cache/chmod g+w components/
chmod g+w images/chmod g+w images/banners/
chmod g+w images/stories/
chmod g+w images/stories/
chmod g+w language/
chmod g+w mambots/
chmod g+w mambots/content/
chmod g+w mambots/editors/
chmod g+w mambots/editors-xtd/
chmod g+w mambots/search/
chmod g+w mambots/system/
chmod g+w media/
chmod g+w modules/
chmod g+w templates/


コメント