Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux: command to make folders recursively writable without affecting the permission of files inside them

Is it possible to make the folders writable recursively without affecting the files inside them using Linux command.

chmod 777 -R foldername - will make all folders and files inside the folder writable.

We've a website where we do not want the core files of a php framework writable, but at the same time we should be able to add new files.

like image 394
Sankar V Avatar asked Nov 22 '13 06:11

Sankar V


People also ask

How do I change folder permissions recursively?

You can change permissions of files using numeric or symbolic mode with the chmod command. Use the chmod command with the R (recursive) option to work on all directories and files under a given directory. The permissions of a file can be changed only with the user with sudo priviledges, or the file owner.

How do you change file permissions in Linux recursively?

If you need to change a file permission, use the chmod command. It also allows to change the file permission recursively to configure multiple files and sub-directories using a single command.

Does chmod work recursively?

Changing permissions with chmod To modify the permission flags on existing files and directories, use the chmod command ("change mode"). It can be used for individual files or it can be run recursively with the -R option to change permissions for all of the subdirectories and files within a directory.


1 Answers

You can say:

find foldername -type d -exec chmod 777 {} \;

This would only change the file mode for the directories and not the files within those.

like image 111
devnull Avatar answered Sep 19 '22 05:09

devnull