linux 文件权限

2016-12-04  本文已影响13人  小小机器人

执行命令ll


权限解释(针对目录):
[root@localhost tmp]# ll | grep testdir
drwxr-x--x. 2 root  root    4096 Dec  4 14:52 testdir
[root@localhost tmp]# cd testdir/
[root@localhost testdir]# ll 
total 4
-rw-r--r--. 1 root root 15 Dec  4 11:47 test
[xxjqr@localhost tmp]$ ll | grep testdir
drwxr-x--x. 2 root  root    4096 Dec  4 14:52 testdir
[xxjqr@localhost tmp]$ cd testdir/
[xxjqr@localhost testdir]$ ll
ls: cannot open directory .: Permission denied
[xxjqr@localhost testdir]$ cat test
This file is created by the root user
权限修改:
[root@localhost testdir]# ll
total 4
-r--r--rwx. 1 root root 15 Dec  4 11:47 test
[root@localhost testdir]# chmod ug+x,o-rw test
[root@localhost testdir]# ll
total 4
-r-xr-x--x. 1 root root 15 Dec  4 11:47 test

权限的数字设定

[root@localhost testdir]# ll
total 4
-r-xr-x--x. 1 root root 15 Dec  4 11:47 test
[root@localhost testdir]# chmod 741 test
[root@localhost testdir]# ll
total 4
-rwxr----x. 1 root root 15 Dec  4 11:47 test

修改所属主与所属组
[root@localhost testdir]# ll
total 4
-rwxr----x. 1 root root 15 Dec  4 11:47 test
[root@localhost testdir]# chown xxjqr:xxjqr test #更改文件属主和属组
[root@localhost testdir]# ll
total 4
-rwxr----x. 1 xxjqr xxjqr 15 Dec  4 11:47 test

上一篇 下一篇

猜你喜欢

热点阅读