日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

linux中ugo权限管理(chmod/chown)

發布時間:2023/12/25 综合教程 32 生活家
生活随笔 收集整理的這篇文章主要介紹了 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權限對應的相關命令:

對普通文件而言:



r
--cat/tac/more/less/head/tail/vim



w ---vim :wq
>
>>
2>
2>>



x
---可執行。

對目錄文件而言:



r
--ls



w
--mkdir
touch >
rm



x
---
cd



修改ugo權限:chmod

[root@localhost test]# ll

total
0

-rw-r--r-- 1
root root 0 Oct 3 17:46 a

-rw-r--r-- 1
root root 0 Oct 3 17:46 b

-rw-r--r-- 1
root root 0 Oct 3 17:46 c

[root@localhost test]# chmod
+w a
--單獨給user加w權限,與chmod
u+w a 相同。

[root@localhost test]# chmod
a+w b
--給ugo都加w權限。

用8進制數字表示ugo權限:

數字權限:三位一段,一共三段.(排列順序必定是rwx,什么都不是,補位-,依次可用4 2 1
0表示)
r --read
4

w
- write
2

x
--execute
1

-
--null
0

[root@localhost test]# chmod 777
d.sh ---給文件d.sh的ugo都加rwx權限。

修改文件屬主與屬組權限:chown user:group file_name

修改文件屬主和屬組:chown user:group
file_name

修改文件屬主: chown user file_name

修改文件屬組:chown :group file_name

修改文件屬主及自動匹配屬組: chown user:
file_name

[root@localhost test]# ll
e

-rw-r--r-- 1
root root 0 Oct 3 17:50 e

[root@localhost test]# id
lbg

uid=1000(lbg)
gid=1000(lbg) groups=1000(lbg)

[root@localhost test]# chown
lbg e
--單獨修改文件的屬主

[root@localhost test]# ll
e

-rw-r--r-- 1
lbg root 0 Oct 3 17:50
e

[root@localhost test]# chown
:lbg f

[root@localhost test]# ll
f

-rw-r--r-- 1
root lbg 0 Oct 3 17:50 f

----單獨修改文件的屬組

[root@localhost test]# chown
lbg: g
--修改文件屬主和屬組

[root@localhost test]# ll
g

-rw-r--r-- 1
lbg lbg 0 Oct 3 18:00 g

對目錄權限修改時:加上-R表示遞歸修改.(目錄里面文件一起修改.)

[root@localhost test]# chown
-R lbg: ha

[root@localhost ha]# ll
/test/ha

-rw-r--r-- 1
lbg lbg 0 Oct 3 18:01 1

-rw-r--r-- 1
lbg lbg 0 Oct 3 18:01 3

總結

以上是生活随笔為你收集整理的linux中ugo权限管理(chmod/chown)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。