Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change file permission for all sub-directories (CHMOD)

I've a directory, inside which I've multiple directories each containing several image files.

I want to change the file permissions to 755 for all the sub-directories and the image files inside them.

I'm using WinSCP to connect to the server. So how do I change the file permissions in one go as I can't keep changing one by one since there are lots of files.

like image 511
ptamzz Avatar asked Oct 05 '11 16:10

ptamzz


People also ask

How do I apply chmod to all subdirectories?

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.

What is the difference between chmod 777 and 755?

A 777 permission on the directory means that everyone has access to read/write/execute (execute on a directory means that you can do an ls of the directory). 755 means read and execute access for everyone and also write access for the owner of the file.

Which chmod option changes file permission in the current directory and all subdirectories?

One of the options to change multiple files is to run chmod recursive with the -R (recursive, and not the capital) option. The recursive option will change the permissions for all the files, including those under sub-directories, inside a given path. 1. Consider the following command, chmod -R a=r,u=rwx my_dir .

How do you change the permission of all the files in a directory?

It is common to use the basic chmod command to change the permission of a single file. However, you may need to modify the permission recursively for all files within a directory. In such cases, the chmod recursive option ( -R or --recursive ) sets the permission for a directory (and the files it contains).


1 Answers

If you have shell access to the server you can execute

chmod -R 755 {DIR}

The -R means recursive.

Edit: If you only have access via WinSCP you should be able to select the files/directories you want and change the permissions recursively

like image 115
nachito Avatar answered Oct 19 '22 15:10

nachito