0 = none 1 = execute only 2 = write only 3 = write and execute (1+2) 4 = read only 5 = read and execute (4+1) 6 = read and write (4+2) 7 = read and write and execute (4+2+1) + allow, - deny +r adds read access +w adds write access +x allows execution u = user, g = group, o = other # Change file permissions Examples: chmod +r file.txt chmod u+r g+r file.txt chmod o-w file.txt # ( user group other ), so 664 is u:r/w g:r/w o:r chmod 664 file.txt #Change ownership of a file: chown owner:group file chown dave:www-data file.txt # Add write protection, must be root....: chattr +i data.txt # Remove write protection, must be root....: chattr -i data.txt # Change all directories to 775 find /var/www/myproject -type d -exec chmod 775 {} \; # Change all file to 664 find /var/www/myproject -type f -exec chmod 664 {} \;