EDX Linux Foundation Ch 9:User Environment Section 5 File Permissions
File Ownership

0.File Permission Modes
| rwx: | rwx: | rwx |
|---|---|---|
| u: | g: | o |
rwx
Files have three kinds of permissions: read (r), write (w), execute (x). These are generally represented as in rwx.
ugo
u:user/owner
g:group
0:others
1.chmod
1 | |
This kind of syntax can be difficult to type and remember
so one often uses a shorthand which lets you set all the permissions in one step.
4 if read permission is desired.
2 if write permission is desired.
1 if execute permission is desired.
Thus 7 means read/write/execute, 6 means read/write, and 5 means read/execute.
When you apply this to the chmod command you have to give three digits for each degree of freedom, such as in
1 | |
2.chown
有三個檔案file-1, file-2, temp
1 | |
對file-1下chown改變檔案擁有者為root
1 | |
下ls -a看檔案完整的訊息,發現檔案擁有者已經改變成root。
1 | |
3.chgrp
續上面的例子:這次對file-2下chgrp改變檔案的群組。
1 | |