Skip to content

Instantly share code, notes, and snippets.

@ibreathebsb
Last active August 20, 2018 11:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ibreathebsb/cc6829d77d5a7fdf6be527b4c998b28b to your computer and use it in GitHub Desktop.
Save ibreathebsb/cc6829d77d5a7fdf6be527b4c998b28b to your computer and use it in GitHub Desktop.

SUID

  1. 只对二进制程序有效,对shell脚本或者目录无效
  2. 拥有者的权限执行位改为s
  3. 执行者拥有x权限
  4. 执行者在运行程序过程中将获得改文件拥有者的权限

SGID

  1. 用于二进制程序与SUID类似,不过获得的是群组的权限
  2. 用与目录时,若用户对于该目录具有rx权限,则用户可以进入该目录,用户在该目录下的有效群组将变成目录的群组, 若用户对目录具有w权限,则用户在该目录下创建的文件群组为该目录的群组,这对于协同工作十分有益

SBIT

  1. 只对目录有效
  2. 若用户对于目录具有wx权限,则只有root和用户本人才能删除用户在该目录下创建的文件

修改特殊权限

用额外一位数字表示

例如:

chmod 4755 file = chmod u+s file

chmod 2765 file = chmod g+s file

chmod 1777 file = chmod o+t, file

注意,若对于文件没有x权限,则对应位置会变成大写的S或者T chmod 1754 dir => drwxr-xr-T

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment