How can I do "chmod 704" to a folder which I want it to allow others to access and download the entire folder including its sub-folders and files?
Thanks, Baha
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityFrom the looks of it, you have the permissions the wrong order. When referencing permission masks with three digits, the order is owner|group|world
In other words, a 704
mask means owner gets it all (as it should be, in most cases), group members don't get anything (which I find a bit odd), and everyone else gets read only.
If you want everyone to be able to read (and hence copy) a folder of yours, including any subfolders, the folder in question should have 755
, as well as any subfolders. Files should normally be 644
, except from executable ones which should be 755
A lazy way of achieving what you want is chmod -R 755 /some/folder/that/you/want/to/share
. This will apply a 755
to that folder, and all files and subfolders within. It has the downside of making all files executable (including the ones that shouldn't be), but in most cases this is OK and only a little bit cringeworthy.
You probably don't want to grant execution on files, but you want directory access.
find . -type d -exec chmod 755 {} \;
for directories : grant all permissions to owner, read and access to group and others
find . -type f -exec chmod 644 {} \;
for regular files : grant read and write to owner, read to group and others
See details and more advanced usage here : https://serverfault.com/questions/363425/change-all-file-permissions-to-644-and-all-folder-permissions-to-755-recursively/
group
value to be greater than or equal to yourother
argument. it can have unexpected results. Also, if you want the entire directory structure to take on these permissions, add the-R
option to your chmod command.