Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

changing permissions of files in a directory recursively

Tags:

linux

find

chmod

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
like image 679
user1934146 Avatar asked Dec 07 '22 06:12

user1934146


1 Answers

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.

like image 76
2 revs, 2 users 93% Avatar answered Dec 08 '22 19:12

2 revs, 2 users 93%