You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
dotfiles/cheats/chmod.txt

38 lines
827 B

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 {} \;