2010年6月1日 星期二

linux利用find來chmod資料夾與檔案權限

因為想設定apache的umask一直無法設定。只好使用crontab 來設定

結合 find與chmod的指令來改變其資料夾與檔案權限,而不直接chmod

(如chmod 755 /dir 時,使用php上傳資料無法寫入就會受到影響要 chmod 777 /dir)

所以只改該路徑下所有 dir的權限為:

.為根目錄,也可改成/tmp之類~

find . -type d -exec chmod 755 {} \;

改該路徑下所有file 的權限為~

find . -type f -exec chmod 644 {} \;


來源

http://movabletripe.com/archive/recursively-chmod-directories-only/

沒有留言: