0
I'm trying to use find
in conjunction with -exec
and chmod
to recursively change the permissions on every file and directory inside a folder via SSH.
I want to do these two commands in one line:
find /share/Multimedia/ -type f -exec chmod 644 {} \;
find /share/Multimedia/ -type d -exec chmod 755 {} \;
I was able to find a solution prior that someone else posted somewhere and for some reason my bash command history was cleared and I did not write down the syntax I was using elsewhere for reference. I don't often do this so I'm not too savvy on standard Unix commands.
I was using something along the lines of:
# probably won't execute
find /share/Multimedia/ ( if -type f -exec chmod 644 {} \; else if -type d -exec chmod 755 {} \; )
I only want to run this on my NAS every now and then to normalize permissions in one go, possibly unattended to do something else in the meantime while my NAS processes it.
That's kind of the thing, my NAS sets kind of arbitrary permissions on new files and I want to normalize them to how I feel comfortable of permissions on files and directories. Thanks for the thorough explanation. I think the first one was what I was looking for :) – SebinNyshkim – 2016-11-27T17:19:39.293