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.
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.
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.
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 .
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).
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With