chmod
Change the mode of each FILE to MODE.
chmod [option]... MODE[,MODE]... FILE...
chmod [option]... OCTAL-MODE file...
chmod [option]... --reference=RFILE file
-c, --changes like verbose但只在改变成功后
-f, --silent, --quiet 忽略出错信息
-v, --verbose 输出详细信息
--reference=RFILE 应用REILE's模式
-R, --recursive 递推修改文件和文件夹的模式
--help
--version
u: user o: other g: group a: all
+-=
w: write r:read x:execute
文件模式
两个字节表示文件的模式,说明文件的类型和访问权限。低12设置访问权限,最高4位表示文件的类型。
八进制最低3位说明了文件的访问权限,
2 1 0
读权限(4) 写权限(2) 执行权限(1)
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
文件类型 设置UID 设置GID 粘附位 user group other
0001 FIFO文件
0010 字符设备文件
0100 目录文件
0110 块设备文件
1000 普通文件
1010 符号链接文件
1100 套接口文件
BASH_BUILTINS(1)
umask [-p] [-S] [mode]
The user file-creation mask is set to mode. If mode begins with a digit, it is interpreted as an octal number; otherwise it is interpreted as a symbolic mode mask similar to that accepted by chmod. If mode is omitted, the current value of the mask is printed. The -S option causes the mask to be printed in symbolic form; the default output is an octal number. If the -p option is supplied, and mode is omitted, the output is in a form that may be reused as input. The return status is 0 if the mode was successfully changed or if no mode argument was supplied, and false otherwise.
Change the mode of each FILE to MODE.
chmod [option]... MODE[,MODE]... FILE...
chmod [option]... OCTAL-MODE file...
chmod [option]... --reference=RFILE file
-c, --changes like verbose但只在改变成功后
-f, --silent, --quiet 忽略出错信息
-v, --verbose 输出详细信息
--reference=RFILE 应用REILE's模式
-R, --recursive 递推修改文件和文件夹的模式
--help
--version
u: user o: other g: group a: all
+-=
w: write r:read x:execute
文件模式
两个字节表示文件的模式,说明文件的类型和访问权限。低12设置访问权限,最高4位表示文件的类型。
八进制最低3位说明了文件的访问权限,
2 1 0
读权限(4) 写权限(2) 执行权限(1)
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
文件类型 设置UID 设置GID 粘附位 user group other
0001 FIFO文件
0010 字符设备文件
0100 目录文件
0110 块设备文件
1000 普通文件
1010 符号链接文件
1100 套接口文件
BASH_BUILTINS(1)
umask [-p] [-S] [mode]
The user file-creation mask is set to mode. If mode begins with a digit, it is interpreted as an octal number; otherwise it is interpreted as a symbolic mode mask similar to that accepted by chmod. If mode is omitted, the current value of the mask is printed. The -S option causes the mask to be printed in symbolic form; the default output is an octal number. If the -p option is supplied, and mode is omitted, the output is in a form that may be reused as input. The return status is 0 if the mode was successfully changed or if no mode argument was supplied, and false otherwise.
umask指定创建文件时的默认权限的掩码。其默认值是0022,此时建立的文件默认权限是644(6-0,6-2,6-2),建立的目录的默认权限是755(7-0,7-2,7-2)。