基本权限管理

1、基本访问权限

读权限r,写权限w,可执行x

默认创建文件644 满权限666

默认创建目录755 满权限777

2、归属(所有权)

属主:拥有该文件的用户账号

设置文件或目录权限 chmod 命令

-R :表示以递归的方式设置目录及目录下的所有子目录及文件的权限

-u : 属组

o :其他人

a : 所有人

+ :添加

- : 删除

= : 重置

nnn : 8 进制的数字权限,如:777 666 644 755 等

[root@localhost ~]# echo "hello,student" > stu,txt
[root@localhost ~]# ls -l stu,txt 
-rw-r--r--. 1 root root 14 9月  16 15:38 stu,txt
[root@localhost ~]# chmod u+x,g+w stu,txt 
[root@localhost ~]# ls -l stu,txt 
-rwxrw-r--. 1 root root 14 9月  16 15:38 stu,txt
[root@localhost ~]# chmod 644 stu,txt 
[root@localhost ~]# ls -l stu,txt 
-rw-r--r--. 1 root root 14 9月  16 15:38 stu,txt
[root@localhost ~]# echo "hello,student" > stu,txt
[root@localhost ~]# ls -l stu,txt 
-rw-r--r--. 1 root root 14 9月  16 15:38 stu,txt
[root@localhost ~]# chmod u+x,g+w stu,txt 
[root@localhost ~]# ls -l stu,txt 
-rwxrw-r--. 1 root root 14 9月  16 15:38 stu,txt
[root@localhost ~]# chmod 644 stu,txt 
[root@localhost ~]# ls -l stu,txt 
-rw-r--r--. 1 root root 14 9月  16 15:38 stu,txt
[root@localhost ~]# chown :nginx stu,txt 
[root@localhost ~]# ls -l stu,txt 
-rw-r--r--. 1 nginx nginx 14 9月  16 15:38 stu,txt
[root@localhost ~]# chown root:root stu,txt 
[root@localhost ~]# ls -l stu,txt 
-rw-r--r--. 1 root root 14 9月  16 15:38 stu,txt

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值