1、目錄權限設置很重要:能夠有效防範黑客上傳木馬文件.
若是經過 chmod 644 * -R 的話,php文件就沒有權限訪問了。
若是經過chmod 755 * -R 的話,php文件的權限就高了。
因此就須要分開設置目錄權限和文件權限:
php
find /path -type f -exec chmod 644 {} \; //設置文件權限爲644
find /path -type d -exec chmod 755 {} \; //設置目錄權限爲755
設置完成後,再經過命令:chown root:root * -R 將目錄和文件的全部者改成root。
這樣就更加安全了。
html
進入到phpcms 安裝根目錄,選取全部文件:
設置數字值爲:755,同時選定:選擇遞歸處理子目錄,只應用到目錄
一樣再選擇全部文件,數字值爲:644,選擇遞歸處理子目錄,只應用到文件
若是設置錯了,從新再設置就能夠了。
2、Linux find命令 查找可疑的木馬文件
linux
虛擬主機配置樣例:
<VirtualHost *:80>
ServerAdmin root@phpip.com
DocumentRoot /data/wwwroot/www
ServerName www.phpip.com
<Directory /data/wwwroot/www>
Options FollowSymLinks
AllowOverride Options FileInfo
Order allow,deny
Allow from all
php_admin_value open_basedir /data/wwwroot/www/:/var/tmp/
DirectoryIndex index.htm index.html index.php
</Directory>
ErrorLog "| /usr/sbin/rotatelogs /data/logs/%m_%d_www.phpip.com-error_log 86400 480"
CustomLog "| /usr/sbin/rotatelogs /data/logs/%m_%d_www.phpip.com-access_log 86400 480" common
</VirtualHost>
四、按天存放apache日誌:
參考上面配置文件:
ErrorLog "| /usr/sbin/rotatelogs /data/logs/%m_%d_www.phpip.com-error_log 86400 480"
CustomLog "| /usr/sbin/rotatelogs /data/logs/%m_%d_www.phpip.com-access_log 86400 480" commonapache
轉載:http://www.phpip.com/html/2014/changjianwenti_0430/133.htmlwindows