Brief introduction
The chmod command is used to change the access rights of a Linux system file or directory, and to control the user/user group's access to a file or directory.
Usage:
Two usages: 1) Use the letter R (Read), W (write), X (execute) to indicate the permission type, 2) to indicate with a number, 4 for reading, 2 for writing, and 1 for execution.
The user group for the face of the permissions property of the file/folder is owner (owner), owner Group (member of the user group where the owner resides), others (other user). So chmod 760 test_foler/equals chmod u=rwx,g=rw test_foler/.
In addition to the display of security permissions, you can also add a limitation permission. For example, chmod a-x Test_foler means to remove the execution rights of the folder three security entities. A=all, that is, the meaning of all, u=user, that is, owner;g=group,owner the user group, O is others.
[Email protected]:/tmp$chmodA-x test_foler/[email protected]:/tmp$ lltotal -DRWXRWXRWTTenRoot root4096Dec - xx:Panax Notoginseng./drwxr-xr-x atRoot root4096Dec5 -: +.. /-RW-------1Jerry Jerry0Dec8 to: -config-err-QQX6NDDRWXR-xr-x2Jerry Jerry4096Dec8 ,: -hsperfdata_jerry/DRWXRWXRWT2Root root4096Dec8 to: -. ice-unix/DRWXRWXR-X3Jerry Jerry4096Dec8 the: -jdk/DRW-rw-rw-2Jerry Jerry4096Dec - xx: +test_foler/-rw-rw-r--1Jerry Jerry0Dec8 to: -Unity_support_test.0-rw-r--r--1Root root1839Dec8 to: -Vgauthsvclog.txt.0DRWXRWXRWT2Root root4096Dec8 to: -vmwarednd/drwx------2Jerry Jerry4096Dec8 to: -vmware-jerry/drwx------2Root root4096Dec8 to: -vmware-root/-r--r--r--1Root root OneDec8 to: -. x0-LOCKDRWXRWXRWT2Root root4096Dec8 to: -. x11-unix/[email protected]:/tmp$
With chmod a+x test_foler/and back.
Parameter R applies to sub files and folders, such as Chmod-r a+x test_foler/
[Email protected]:/tmp/test_foler$mkdir 666Sub_folder[email protected]:/tmp/test_foler$ lltotal -drwxrwxrwx4Jerry Jerry4096Dec - xx: +./DRWXRWXRWTTenRoot root4096Dec - xx: the.. /DRWXRWXR-X2Jerry Jerry4096Dec - xx: + 666/DRWXRWXR-X2Jerry Jerry4096Dec - xx: +sub_folder/[email protected]:/tmp/test_foler$chmod-R a+x/tmp/test_foler/[email protected]:/tmp/test_foler$ lltotal -drwxrwxrwx4Jerry Jerry4096Dec - xx: +./DRWXRWXRWTTenRoot root4096Dec - xx: +.. /DRWXRWXR-X2Jerry Jerry4096Dec - xx: + 666/DRWXRWXR-X2Jerry Jerry4096Dec - xx: +sub_folder/[email protected]:/tmp/test_foler$ CD sub_folder/[email protected]:/tmp/test_foler/sub_folder$TouchA[email protected]:/tmp/test_foler/sub_folder$ lltotal8DRWXRWXR-X2Jerry Jerry4096Dec - xx: -./drwxrwxrwx4Jerry Jerry4096Dec - xx: +.. /-rw-rw-r--1Jerry Jerry0Dec - xx: -A[email protected]:/tmp/test_foler/sub_folder$chmod-R a+x/tmp/test_foler/[email protected]:/tmp/test_foler/sub_folder$ lltotal8DRWXRWXR-X2Jerry Jerry4096Dec - xx: -./drwxrwxrwx4Jerry Jerry4096Dec - xx: +.. /-rwxrwxr-x1Jerry Jerry0Dec - xx: -A *[email protected]:/tmp/test_foler/sub_folder$
Linux->> chmod command changes File/folder properties