linux高级权限

which 命令查找命令的所在位置

1.suid (set user id)

作用: 任何用户在执行拥有suid的二进制可执行文件(命令)时,都以该文件拥有者的身份执行.

对象: user位

命令: chmod u+s 命令(绝对路径)

2.sgid (set group id)

作用: 任何用户在拥有sgid的目录下创建文件时,创建的文件都要继承目录的组

对象: group位

命令: chmod g+s 目录

3.sticky(t权限 冒险位 粘帖位)

作用: 任何用户在拥有t权限的目录下创建的文件,都属于创建者本人,其他人无权删除

对象: other位

命令: chmod o+t 目录

高级权限--通过数字表示

suid 4

sgid 2

sticky 1

t权限和sgid只能作用于目录,guid权限只能作用于文件 因此7777权限没有实际意义

1777   

2777

4777

3777 sgid t

[root@localhost tmp]# chmod 7777 aa.txt

[root@localhost tmp]# ll aa.txt

-rwsrwsrwt 1 root root 0 7月 26 15:18 aa.txt

[root@localhost tmp]# chmod a-x aa.txt

[root@localhost tmp]# ll aa.txt

-rwSrwSrwT 1 root root 0 7月 26 15:18 aa.txt

文件系统属性

[root@localhost tmp]# chattr +i test/

[root@localhost tmp]# lsattr -d test/   

----i----------- test/

[root@localhost tmp]# chattr -i test/

i

文件: 该文件不可以删除, 剪切,修改,重命名,权限修改 只可以查看和cp

目录: 该目录(包括该目录)下, 不可以删除,创建,剪切,重命名, 但是可以修改文件内容,权限,拥有者,所属组

a

文件: 该文件不可以删除, 剪切,修改,重命名,权限修改 只可以查看和cp 和追加内容

目录: 该目录(包括该目录)下, 不可以删除,剪切,重命名, 但是可以修改文件内容,权限,拥有者,所属组,创建文件

facl 访问控制列表(file access control list)

setfacl

getfacl

设置额外用户权限

[root@localhost tmp]# setfacl -m u:zorro:rw tt.txt

设置额外组权限

[root@localhost tmp]# setfacl -m g:east:rw tt.txt

mask 无论额外用户或者额外组的权限不能超过mask

设置mask值

[root@localhost tmp]# setfacl -m m:r tt.txt

删除额外用户权限

[root@localhost tmp]# setfacl -x u:zorro tt.txt

删除额外组权限

[root@localhost tmp]# setfacl -x g:east tt.txt

删除所有的额外用户和组权限,并且去掉+

[root@localhost tmp]# setfacl -b tt.txt

继承功能 -d default

[root@localhost tmp]# setfacl -m u:robin:rwx test/

[root@localhost tmp]# setfacl -d -m u:robin:rwx test/

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值