国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Linux > 正文

Linux文件/目錄的權限及歸屬管理使用

2024-08-28 00:04:42
字體:
來源:轉載
供稿:網友

一、文件的權限和歸屬概述

1、訪問權限

讀取r:允許查看文件內容、顯示目錄列表;

寫入w:允許修改文件內容,允許在目錄中新建、移動、刪除文件或子目錄;

可執行x:允許運行程序、切換目錄

2、歸屬(所有權)

屬主:擁有該文件或目錄的用戶賬號;

屬組:擁有該文件或目錄的組賬號;

3、查看文件的權限和歸屬

Linux文件/目錄的權限及歸屬管理精講

4、chmod設置文件權限

chmod命令的基本語法格式如下:

Linux文件/目錄的權限及歸屬管理精講

應用舉例:

[root@centos01 ~]# touch 1.txt   <!--創建1.txt文件-->[root@centos01 ~]# ll 總用量 8-rw-r--r-- 1 root root  0 1月 11 22:27 1.txt-rw-------. 1 root root 1572 10月 23 22:37 anaconda-ks.cfg-rw-r--r--. 1 root root 1603 10月 23 23:36 initial-setup-ks.cfg[root@centos01 ~]# chmod u+x ./1.txt <!--屬主用戶添加執行權限-->[root@centos01 ~]# ll總用量 8-rwxr--r-- 1 root root  0 1月 11 22:27 1.txt-rw-------. 1 root root 1572 10月 23 22:37 anaconda-ks.cfg-rw-r--r--. 1 root root 1603 10月 23 23:36 initial-setup-ks.cfg[root@centos01 ~]# chmod u-x,g+x,o+w 1.txt  <!--屬主用戶取消執行權限,組添加執行權限,其他用戶添加寫入權限-->[root@centos01 ~]# ll總用量 8-rw-r-xrw- 1 root root  0 1月 11 22:27 1.txt-rw-------. 1 root root 1572 10月 23 22:37 anaconda-ks.cfg-rw-r--r--. 1 root root 1603 10月 23 23:36 initial-setup-ks.cfg[root@centos01 ~]# chmod 755 1.txt <!--添加755權限(rwxr-xr-x)-->[root@centos01 ~]# ll總用量 8-rwxr-xr-x 1 root root  0 1月 17 02:36 1.txt-rw-------. 1 root root 1572 10月 23 22:37 anaconda-ks.cfg-rw-r--r--. 1 root root 1603 10月 23 23:36 initial-setup-ks.cfg

5、chown設置文件的歸屬

chown命令的基本語法格式如下:

Linux文件/目錄的權限及歸屬管理精講

應用舉例:

[root@centos01 ~]# chown bob 1.txt <!--1.txt設置屬主-->[root@centos01 ~]# ll總用量 8-rwxr-xr-x 1 bob root  0 1月 17 02:36 1.txt-rw-------. 1 root root 1572 10月 23 22:37 anaconda-ks.cfg-rw-r--r--. 1 root root 1603 10月 23 23:36 initial-setup-ks.cfg[root@centos01 ~]# chown :benet 1.txt <!--1.txt設置屬組-->[root@centos01 ~]# ll總用量 8-rwxr-xr-x 1 bob benet  0 1月 17 02:36 1.txt-rw-------. 1 root root 1572 10月 23 22:37 anaconda-ks.cfg-rw-r--r--. 1 root root 1603 10月 23 23:36 initial-setup-ks.cfg[root@centos01 ~]# chown bob:benet 1.txt <!--1.txt設置屬主和屬組-->[root@centos01 ~]# ll總用量 8-rwxr-xr-x 1 bob benet  0 1月 17 02:36 1.txt-rw-------. 1 root root 1572 10月 23 22:37 anaconda-ks.cfg-rw-r--r--. 1 root root 1603 10月 23 23:36 initial-setup-ks.cfg<!---->

二、目錄的權限和歸屬

1、訪問權限

Linux文件/目錄的權限及歸屬管理精講

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 惠州市| 宿松县| 鹿邑县| 河曲县| 曲松县| 宁安市| 酉阳| 磐安县| 福贡县| 鄂尔多斯市| 广灵县| 德令哈市| 英山县| 通渭县| 平原县| 建宁县| 长宁区| 镇远县| 故城县| 板桥市| 柳州市| 长丰县| 托里县| 鄂托克前旗| 亚东县| 巴马| 西藏| 杭锦后旗| 荥阳市| 昌江| 雅安市| 定襄县| 嘉兴市| 湾仔区| 玉溪市| 磐安县| 依兰县| 梨树县| 乌兰浩特市| 旬邑县| 海阳市|