1、基本访问权限
读权限r,写权限w,可执行x
默认创建文件644 满权限666
默认创建目录755 满权限777
2、归属(所有权)
属主:拥有该文件的用户账号
设置文件或目录权限 chmod 命令
-R :表示以递归的方式设置目录及目录下的所有子目录及文件的权限
-u : 属组
o :其他人
a : 所有人
+ :添加
- : 删除
= : 重置
nnn : 8 进制的数字权限,如:777 666 644 755 等
[root@localhost ~]# echo "hello,student" > stu,txt
[root@localhost ~]# ls -l stu,txt
-rw-r--r--. 1 root root 14 9月 16 15:38 stu,txt
[root@localhost ~]# chmod u+x,g+w stu,txt
[root@localhost ~]# ls -l stu,txt
-rwxrw-r--. 1 root root 14 9月 16 15:38 stu,txt
[root@localhost ~]# chmod 644 stu,txt
[root@localhost ~]# ls -l stu,txt
-rw-r--r--. 1 root root 14 9月 16 15:38 stu,txt
[root@localhost ~]# echo "hello,student" > stu,txt
[root@localhost ~]# ls -l stu,txt
-rw-r--r--. 1 root root 14 9月 16 15:38 stu,txt
[root@localhost ~]# chmod u+x,g+w stu,txt
[root@localhost ~]# ls -l stu,txt
-rwxrw-r--. 1 root root 14 9月 16 15:38 stu,txt
[root@localhost ~]# chmod 644 stu,txt
[root@localhost ~]# ls -l stu,txt
-rw-r--r--. 1 root root 14 9月 16 15:38 stu,txt
[root@localhost ~]# chown :nginx stu,txt
[root@localhost ~]# ls -l stu,txt
-rw-r--r--. 1 nginx nginx 14 9月 16 15:38 stu,txt
[root@localhost ~]# chown root:root stu,txt
[root@localhost ~]# ls -l stu,txt
-rw-r--r--. 1 root root 14 9月 16 15:38 stu,txt