Linux – Chmod to allow read and write permissions for directory

chmodlinuxpermissions

I have created directories in root. I am looking for the chmod command to allow all users read and write permissions to a specific directory. I have done chmod 775 for a file but I need this for a directory. This includes permissions on all files and sub directories.

Best Answer

0775 is rarely correct for a file. The following will add the appropriate desired permissions to the appropriate type, without disturbing other existing permissions:

find somedir \( -type d -exec chmod u+rwx,g+rwx,o+rx {} \; -o -type f -exec chmod u+rw,g+rw,o+r {} \; \)

See the man page for find to help decipher that.

Related Question