修改权限
新建文件
[root@liunan /]# ls -ld /test
drwxr-xr-x. 2 root root 6 8月 21 09:38 /test
d 表示是目录
rwx 所有用户 可读,可写,可执行(进入目录)
修改用户与用户组
chown user1:group1 /test
[root@liunan /]# ls -ld /test
drwxr-xr-x. 2 user1 group1 6 8月 21 09:38 /test
[root@liunan /]#
修改文件的权限
[root@liunan test]# ll
总用量 4
-rw-r--r--. 1 root root 65 8月 21 10:17 a.txt
修改用户权限 -u + - =
如 u 后面的值 rwx 421
总用量 4
-rw-r--r--. 1 root root 65 8月 21 10:17 a.txt
[root@liunan test]# chmod u+x a.txt
[root@liunan test]# ll
总用量 4
-rwxr--r--. 1 root root 65 8月 21 10:17 a.txt
修改用户组权限 -g + - =
如 g 后面的值 rwx 421
[root@liunan test]# chmod g-r a.txt
[root@liunan test]# ll
总用量 4
-rwx---r--. 1 root root 65 8月 21 10:17 a.txt
[root@liunan test]#
修改其它用户权限 -o
如 o 后面的值 rwx 421
-rwxr--r--. 1 root root 65 8月 21 10:17 a.txt
[root@liunan test]# chmod o=rwx a.txt
[root@liunan test]# ll
总用量 4
-rwxr--rwx. 1 root root 65 8月 21 10:17 a.txt
[root@liunan test]#
所有-a
[root@liunan test]# ll
总用量 4
-rwx---r--. 1 root root 65 8月 21 10:17 a.txt
[root@liunan test]# chmod a+r a.txt
[root@liunan test]# ll
总用量 4
-rwxr--r--. 1 root root 65 8月 21 10:17 a.txt
[root@liunan test]#
数字设置
rwx
r 4 w-2 x -1
-rwxr--rwx. 1 root root 65 8月 21 10:17 a.txt
[root@liunan test]# chmod 446
chmod: "446" 后缺少操作数
Try 'chmod --help' for more information.
[root@liunan test]# chmod 446 a.txt
[root@liunan test]# ll
总用量 4
-r--r--rw-. 1 root root 65 8月 21 10:17 a.txt
[root@liunan test]# touch b.txt
[root@liunan test]# ll
总用量 4
-r--r--rw-. 1 root root 65 8月 21 10:17 a.txt
-rw-r--r--. 1 root root 0 8月 21 10:28 b.txt
[root@liunan test]# chmod 644 a.txt
[root@liunan test]# ll
总用量 4
-rw-r--r--. 1 root root 65 8月 21 10:17 a.txt
-rw-r--r--. 1 root root 0 8月 21 10:28 b.txt
[root@liunan test]#