[英]changing permissions of files in a directory recursively
I am trying to change the permissions of a files present in a directory and subdirectories using the below command and running into below error..can anyone help? 我正在尝试使用以下命令更改目录和子目录中存在的文件的权限,并运行到下面的错误..谁可以帮助?
user@machine:/local/mnt/workspace$ find . -type f -exec chmod 644 {} \;
chmod: changing permissions of `./halimpl/ncihal/adaptation/NonVolatileStore.cpp': Operation not permitted
you can run the following command: 您可以运行以下命令:
#chown -R directory_path
But it will change the permissions of directories also. 但它也会改变目录的权限。
For only files, you can run. 对于只有文件,您可以运行。
#find directory_path -type f -exec chmod 644 {} \;
It also looks like you dont have enough permissions. 它看起来你没有足够的权限。 try
尝试
#sudo find directory_path -type f -exec chmod 644 {} \;
or run the command as root user. 或以root用户身份运行命令。
It looks to me like you don't have permission to change NonVolatileStore.cpp. 在我看来,你没有权限更改NonVolatileStore.cpp。
Are you aware of chmod
's -R
switch that recursively changes permissions? 您是否知道
chmod
的-R
开关以递归方式更改权限?
如果您拥有root权限,请尝试:
sudo find . -type f -exec chmod 644 {} \;
It could be that you simply don't own that file. 可能是您根本就没有该文件。 Run an
ls -l
on it to see full permissions and who the owner is. 在其上运行
ls -l
以查看完整权限以及所有者是谁。
It could also be the filesystem is read only. 它也可能是文件系统是只读的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.