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/