linux中ugo权限管理(chmod/chown)
查看ugo權限: ll
| [root@localhost test]# ll
total 12 -rwxr-xr-x 2 root root 4 Oct 3 11:44 a lrwxrwxrwx 1 root root 1 Oct 3 15:57 a.soft -> a drwxr-xr-x 2 root root 6 Oct 3 15:54 b -rw-r--r-- 1 root root 3 Oct 3 11:09 cron -rwxr-xr-x 2 root root 4 Oct 3 11:44 p |
ugo分析說明:
| ugo: user-group-other 除了x可執行權限,其他對root用戶無約束力。
針對-rw-r--r--的分析:第1位表示文件類型。2-10表示ugo權限,三位一段,一共三段。 2-4位表示user文件屬主權限。5-7位表示group文件屬組權限。8-10位表示other權限。 |
rwx權限對應的相關命令:
| 對普通文件而言:
對目錄文件而言:
|
修改ugo權限:chmod
| [root@localhost test]# ll
total -rw-r--r-- 1 -rw-r--r-- 1 -rw-r--r-- 1 [root@localhost test]# chmod [root@localhost test]# chmod |
用8進制數字表示ugo權限:
| 數字權限:三位一段,一共三段.(排列順序必定是rwx,什么都不是,補位-,依次可用4 2 1 0表示) r --read 4 w x - [root@localhost test]# chmod 777 |
修改文件屬主與屬組權限:chown user:group file_name
| 修改文件屬主和屬組:chown user:group file_name 修改文件屬主: chown user file_name 修改文件屬組:chown :group file_name 修改文件屬主及自動匹配屬組: chown user: [root@localhost test]# ll -rw-r--r-- 1 [root@localhost test]# id uid=1000(lbg) [root@localhost test]# chown [root@localhost test]# ll -rw-r--r-- 1 [root@localhost test]# chown [root@localhost test]# ll -rw-r--r-- 1 [root@localhost test]# chown [root@localhost test]# ll -rw-r--r-- 1 對目錄權限修改時:加上-R表示遞歸修改.(目錄里面文件一起修改.) [root@localhost test]# chown [root@localhost ha]# ll -rw-r--r-- 1 -rw-r--r-- 1 |
總結
以上是生活随笔為你收集整理的linux中ugo权限管理(chmod/chown)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 地址栏中的问号有什么作用
- 下一篇: 网上邻居无法访问问题的解决办法