欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

linux 修改文件 文件夹权限 有大用

shiping1 的头像

find -type d -exec chmod 745 {} \;
find -type f -exec chmod 644 {} \;
或者
find -type d|xargs chmod 745;
find -type f|xargs chmod 644;

 所以可以只设置文件夹权限为745 文件权限为644

 

把西部数码(因为apache和ftp是同一用户)改成

find -type d|xargs chmod 545;
find -type f|xargs chmod 444;

把西部数码(因为apache和ftp是同一用户)改成  (我一般用下面的方法)
find ./include -type f -exec chmod 444 {} \;
find ./include -type d -exec chmod 545 {} \;

find ./de980JH--__HBNBGGGF888nnn -type f -exec chmod 444 {} \;
find ./de980JH--__HBNBGGGF888nnn -type d -exec chmod 545 {} \;



 

然后 data目录   find -type d|xargs chmod 745;

 

 

find ./include -type d -exec chmod 545 {} \;             当前目录下的 include 文件夹及其设这样的权限

find ./include -type d|xargs chmod 745;                    当前目录下的 include 文件夹及其设这样的权限.

find ./include  -type f -exec chmod 644 {} \;              当前目录下的 include下的文件 改成这样的权限

find ./include -type f|xargs chmod 644;                      当前目录下的 include下的文件 改成这样的权限
 

chmod 777 文件名(文件夹名/)  就是修改文件名(文件夹名) 为 777

 

 

其中u 表示该档案的拥有者,g 表示与该档案的拥有者属于同一个群体(group)者,
o 表示其他以外的人,a 表示这三者皆是。
chmod ugo+r file1.txt    //将档案 file1.txt 设为所有人皆可读取 :

chmod a+r file1.txt      //将档案 file1.txt 设为所有人皆可读取 :

chmod -R lamport:users *   //将目前目录下的所有档案与子目录的拥有者皆设为 users
                           //群体的使用者 lamport :




chmod -R 777 aaa/  把文件夹aaa/下的所有权限改成  777



chmod 664 a.txt  把a.txt的权限设为 664
 

普通分类: