So what does "sudo chmod -R 777 /dir" mean?
|0||No permission at all||---||000|
|3||Write and execute||-wx||011|
|5||Read and execute||r-x||101|
|6||Read and write||rw-||110|
|7||Read, write and execute||rwx||111|
Given the table above - r = read, w = write and x = execute.
sudo – Originally “superuser do”, is a command in UNIX-like machines that allows the user to run programs with (by default) superuser privileges.
chmod – Or “change mode” is a UNIX command that allows the user to change access permissions to files and/or directories.
-R – The command flag to make the operation recursive, or simply put, apply all changes in the directory and its children.
1st Number (7) – Represents the User. 7 means to give the user rwx privilege.
2nd Number (7) – Represents the Group. 7 means to give the group rwx privilege.
3rd Number (7) – Represents Other. 7 means to give “other” rwx privilege. An example of “other” are web browsers. Web browsers won’t have the access to your website if you give -wx privilege to your web server directory.
Many web servers use 755 for directories and 644 for files.
Now you’re ready to mess up with your files.