如何使用chmod?(图文教程)

2025-10-02 18:28:18

1、以目录/home/test为例,可以看到用户redhat3对其有读写执行的权利,而和redhat3用户同一组root用户以及其他用户只有读和执行权利,但是没有写的权利

[root@localhost home]# ls -al

total 36

drwxr-xr-x    6 root     root         4096 Jan 28 12:20 .

drwxr-xr-x   21 root     root         4096 Jan 27 20:20 ..

drwxr-xr-x    5 redhat3  redhat3      4096 Jan 28 11:57 eda

drwx------    2 root     root        16384 Jan 25 20:40 lost+found

drwx------   13 redhat3  redhat3      4096 Jan 28 12:03 redhat3

drwxr-xr-x    2 redhat3  root         4096 Jan 28 12:20 test

[root@localhost home]#

如何使用chmod?(图文教程)

2、若执行下列命令的话,则用户redhat3和同一组root的用户都有读写执行的权利,但是其他用户读写执行都没有权利

[root@localhost home]# chmod 770 /home/test/

[root@localhost home]# ls -al

total 36

drwxr-xr-x    6 root     root         4096 Jan 28 12:20 .

drwxr-xr-x   21 root     root         4096 Jan 27 20:20 ..

drwxr-xr-x    5 redhat3  redhat3      4096 Jan 28 11:57 eda

drwx------    2 root     root        16384 Jan 25 20:40 lost+founddrwx------   13 redhat3  redhat3      4096 Jan 28 12:03 redhat3

drwxrwx---    2 redhat3  root         4096 Jan 28 12:20 test

如何使用chmod?(图文教程)

3、若执行下列命令,则redhat3用户和同一root组用户以及其他用户都有读写执行的权利

[root@localhost home]# chmod 777 /home/test/

[root@localhost home]# ls -al

total 36

drwxr-xr-x    6 root     root         4096 Jan 28 12:20 .

drwxr-xr-x   21 root     root         4096 Jan 27 20:20 ..

drwxr-xr-x    5 redhat3  redhat3      4096 Jan 28 11:57 eda

drwx------    2 root     root        16384 Jan 25 20:40 lost+founddrwx------   13 redhat3  redhat3      4096 Jan 28 12:03 redhat3

drwxrwxrwx    2 redhat3  root         4096 Jan 28 12:20 test

如何使用chmod?(图文教程)

4、若执行下列命令,则redhat3用户和同一root组用户,有读写执行的权利,而其他用户只有读写权利,而没有执行权利

[root@localhost home]# chmod 776 /home/test/

[root@localhost home]# ls -al

total 36

drwxr-xr-x    6 root     root         4096 Jan 28 12:20 .

drwxr-xr-x   21 root     root         4096 Jan 27 20:20 ..

drwxr-xr-x    5 redhat3  redhat3      4096 Jan 28 11:57 eda

drwx------    2 root     root        16384 Jan 25 20:40 lost+founddrwx------   13 redhat3  redhat3      4096 Jan 28 12:03 redhat3

drwxrwxrw-    2 redhat3  root         4096 Jan 28 12:20 test

如何使用chmod?(图文教程)

5、若执行下列命令,则redhat3用户和同一root组用户,有读写执行的权利,而其他用户只有读和执行写权利,而没有写权利

[root@localhost home]# chmod 775 /home/test/

[root@localhost home]# ls -al

total 36

drwxr-xr-x    6 root     root         4096 Jan 28 12:20 .

drwxr-xr-x   21 root     root         4096 Jan 27 20:20 ..

drwxr-xr-x    5 redhat3  redhat3      4096 Jan 28 11:57 eda

drwx------    2 root     root        16384 Jan 25 20:40 lost+founddrwx------   13 redhat3  redhat3      4096 Jan 28 12:03 redhat3

drwxrwxr-x    2 redhat3  root         4096 Jan 28 12:20 test

如何使用chmod?(图文教程)

6、若执行下列命令,则redhat3用户和同一root组用户,有读写执行的权利,而其他用户只有读权利,而没有写和执行权利

[root@localhost home]# chmod 774 /home/test/

[root@localhost home]# ls -al

total 36

drwxr-xr-x    6 root     root         4096 Jan 28 12:20 .

drwxr-xr-x   21 root     root         4096 Jan 27 20:20 ..

drwxr-xr-x    5 redhat3  redhat3      4096 Jan 28 11:57 eda

drwx------    2 root     root        16384 Jan 25 20:40 lost+founddrwx------   13 redhat3  redhat3      4096 Jan 28 12:03 redhat3

drwxrwxr--    2 redhat3  root         4096 Jan 28 12:20 test

如何使用chmod?(图文教程)

7、若执行下列命令,则redhat3用户和同一root组用户,有读写执行的权利,而其他用户只有写权利,而没有读和执行权利

[root@localhost home]# chmod 772 /home/test/

[root@localhost home]# ls -al

total 36

drwxr-xr-x    6 root     root         4096 Jan 28 12:20 .

drwxr-xr-x   21 root     root         4096 Jan 27 20:20 ..

drwxr-xr-x    5 redhat3  redhat3      4096 Jan 28 11:57 eda

drwx------    2 root     root        16384 Jan 25 20:40 lost+founddrwx------   13 redhat3  redhat3      4096 Jan 28 12:03 redhat3

drwxrwx-w-    2 redhat3  root         4096 Jan 28 12:20 test

如何使用chmod?(图文教程)

8、若执行下列命令,则redhat3用户和同一root组用户,有读写执行的权利,而其他用户只有执行权利,而没有读和写权利

 

 

[root@localhost home]# chmod 771 /home/test/

[root@localhost home]# ls -al

total 36

drwxr-xr-x    6 root     root         4096 Jan 28 12:20 .

drwxr-xr-x   21 root     root         4096 Jan 27 20:20 ..

drwxr-xr-x    5 redhat3  redhat3      4096 Jan 28 11:57 eda

drwx------    2 root     root        16384 Jan 25 20:40 lost+founddrwx------   13 redhat3  redhat3      4096 Jan 28 12:03 redhat3

drwxrwx--x    2 redhat3  root         4096 Jan 28 12:20 test

如何使用chmod?(图文教程)

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢