Three types of permissions for files:
读、写、执行 owner: 属主, u group: 属组, g other: 其他, o all 所有, a
The permissions of a file on whether the user has read and write permissions, first determine whether the identity of the owner, if it is immediately effective, if not, see if the next is in this group, if there is immediately effective, if there is no, look at other identity permissions
chmod 命令 修改文件权限 选项: -R: 递归修改权限 例子: chmod -R 755 /data 文件权限: -rwx rwx rwx 421 421 421 文件所有者 文件所属组用户 其它用户
文件最高权限 666 目录最高权限 777umask的默认权限: root 0022 普通用户 0002 算文件权限和目录权限: 普通文件 666 - 002 得到的就是普通文件的权限,有一点普通文件是不能有执行权限的,如果遇到数是奇数再往上加1 目录 777 - 022 目录和文件是有区别的目录直接用777-022得到的结果就是目录的权限文件默认权限 644 -rw-r--r--目录默认权限 755 drwxr-xr-xchown 修改文件的属主和属组 语法: chown [OPTION]... [OWNER][:[GROUP]] FILE... 常用选项: -R: 递归 例子: chown -R web.web /data
Execute permissions work for anyone
For the directory, there is no execute permission to enter this folder, cannot access the folder's metadata, can only look at the file name, cannot access
Default permissions for a folder: Read and execute default
As long as there is a directory of write permissions, you can delete the files or folders inside
X: Add execute permission to directory only, do not add execute permission to files inside folder
An odd number of cases have Execute permissions
Umask value
umask值 可以用来保留在创建文件权限 新建FILE权限: 666-umask 如果所得结果某位存在执行(奇数)权限,则将其权限+1 新建DIR权限: 777-umask 非特权用户umask是 002 root的umask 是 022 umask: 查看 umask #: 设定 umask 002 umask –S 模式方式显示 umask –p 输出可被调用 全局设置: /etc/bashrc 用户设置:~/.bashrcumask值越大说明新建文件的权限越小,反而创建的文件权限大 root 0022 user 0002 普通文件 666 没有执行权限 666 022 文件夹 777 算文件权限和目录权限: 普通文件 666 - 002 得到的就是普通文件的权限,有一点普通文件是不能有执行权限的,如果遇到数是奇数再往上加1 目录 777 - 022 目录和文件是有区别的目录直接用777-022得到的结果就是目录的权限文件默认权限 644 -rw-r--r--目录默认权限 755 drwxr-xr-x特殊权限: 三种特殊权限 suid:独立数字法 4 作用:二进制可执行程序 当一个用户运行程序时,它将不是自己身份执行,而变成管理员 sgid 独立数字法 2 作用:二进制可执行程序 sticky 独立数字法 1 粘置位 只能删自己建的文件其它用户建的文件无法删除
Linux Rights Management