This is how permissions are decoded
0 - No permission
1 - Can Execute (generally reserved for directories)
2 - Can Write
4 - Can Read
Adding 2 + 4 = 6, leads to permission for write and read.
7 means 1 + 2 + 4, basically execute, write and read.
Logically speaking, it is easy to infer that in most scenario there is not much difference between 6 and 7.
Another aspect in connection with permissions - is the file ownership.
This is how file ownerships are decoded
There are total 3 levels of ownership
U - user - also known as owner (the one who creates the file, automatically becomes the owner)
G - group - in linux a new user automatically defaults to the group by same name
O - other - any one who is not part of U or G, i simply describe this as rest of the world.
Each file or directory typically have all these 3 levels. Any permissions that we give is seen with respect to this ownership hierarchy. It is in this order UGO
Read more: https://technologymythbuster.blogspot.com/2018/06/misconception-about-file-ownerships-and.html
For directories:-
r = list (read directory contents)
w = write
x = can access the directory (i.e., cd to the directory)
For files:-
r = read
w = write
x = execute
chmod human | chmod numeric | resulting permission |
ugo=rwx | 777 | rwxrwxrwx |
u-wx | 470 | r--rwx--- |
o+r | 774 | rwxrwxr-- |
g-wx,o+r | 744 | rwxr--r-- |
u-w,g-wx,o+r | 544 | r-xr--r-- |
g=,o=r | 704 | rwx---r-- |
a-wx | 440 | r--r----- |