Linux 基础与应用教程 003(权限管理命令简单基础)

1.chmod  (权限管理)[root@bogon tem]# chmod -R 777 /tem/a/b    递归改变权限;

权限数字法     所有者,root才能更改权限;

r ----4  

w ---2

x ---1

2.chown  改变文件或者所有者;

[root@bogon tem]# touch fengjie
[root@bogon tem]# ls -l fengjie
-rw-r--r--. 1 root root 0 4月 12 11:42 fengjie
[root@bogon tem]# useradd shenchao
[root@bogon tem]#
[root@bogon tem]# chown shenchao fengjie
[root@bogon tem]# ls -l fengjie
-rw-r--r--. 1 shenchao root 0 4月 12 11:42 fengjie

3.chgrp(改变文件所属组)

[root@bogon tem]# groupadd lampbrother
[root@bogon tem]# chgrp lampbrother fengjie
[root@bogon tem]# ls -l fengjie
-rw-r--r--. 1 shenchao lampbrother 0 4月 12 11:42 fengjie
[root@bogon tem]#

[root@bogon tem]# chmod g+w fengjie
[root@bogon tem]# ls -l fengjie
-rw-rw-r--. 1 shenchao lampbrother 0 4月 12 11:42 fengjie

4.umask -S   显示,设置文件的缺省权限;

[root@bogon tem]# mkdir test1
[root@bogon tem]# ls -l test1
总用量 0
[root@bogon tem]# ls -ld test1
drwxr-xr--. 2 root root 6 4月 12 11:58 test1
[root@bogon tem]#(改变成统一的想要的权限)

This moment will nap, you will have a dream; but this moment study, you will interpret a dream.
原文地址:https://www.cnblogs.com/mawenqi-barry/p/8806936.html