文件类型与权限

在这里插入图片描述

在这里插入图片描述

修改权限

在这里插入图片描述
在这里插入图片描述

新建文件
[root@liunan /]# ls -ld /test
drwxr-xr-x. 2 root root 6 8月  21 09:38 /test

d 表示是目录
rwx 所有用户 可读,可写,可执行(进入目录)

修改用户与用户组

chown user1:group1 /test

[root@liunan /]# ls -ld /test
drwxr-xr-x. 2 user1 group1 6 8月  21 09:38 /test
[root@liunan /]# 

修改文件的权限

在这里插入图片描述


[root@liunan test]# ll
总用量 4
-rw-r--r--. 1 root root 65 8月  21 10:17 a.txt

修改用户权限 -u + - =

如 u 后面的值 rwx 421

总用量 4
-rw-r--r--. 1 root root 65 8月  21 10:17 a.txt
[root@liunan test]# chmod u+x a.txt 
[root@liunan test]# ll
总用量 4
-rwxr--r--. 1 root root 65 8月  21 10:17 a.txt

修改用户组权限 -g + - =

如 g 后面的值 rwx 421

[root@liunan test]# chmod g-r a.txt 
[root@liunan test]# ll
总用量 4
-rwx---r--. 1 root root 65 8月  21 10:17 a.txt
[root@liunan test]# 

修改其它用户权限 -o

如 o 后面的值 rwx 421

-rwxr--r--. 1 root root 65 8月  21 10:17 a.txt
[root@liunan test]# chmod o=rwx a.txt 
[root@liunan test]# ll
总用量 4
-rwxr--rwx. 1 root root 65 8月  21 10:17 a.txt
[root@liunan test]# 

所有-a

[root@liunan test]# ll
总用量 4
-rwx---r--. 1 root root 65 8月  21 10:17 a.txt
[root@liunan test]# chmod a+r a.txt 
[root@liunan test]# ll
总用量 4
-rwxr--r--. 1 root root 65 8月  21 10:17 a.txt
[root@liunan test]# 

数字设置

rwx
r 4 w-2 x -1


-rwxr--rwx. 1 root root 65 8月  21 10:17 a.txt
[root@liunan test]# chmod 446
chmod: "446" 后缺少操作数
Try 'chmod --help' for more information.
[root@liunan test]# chmod 446 a.txt 
[root@liunan test]# ll
总用量 4
-r--r--rw-. 1 root root 65 8月  21 10:17 a.txt
[root@liunan test]# touch b.txt
[root@liunan test]# ll
总用量 4
-r--r--rw-. 1 root root 65 8月  21 10:17 a.txt
-rw-r--r--. 1 root root  0 8月  21 10:28 b.txt
[root@liunan test]# chmod 644 a.txt 
[root@liunan test]# ll
总用量 4
-rw-r--r--. 1 root root 65 8月  21 10:17 a.txt
-rw-r--r--. 1 root root  0 8月  21 10:28 b.txt
[root@liunan test]# 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值