新聞中心
一、文件的權(quán)限和歸屬概述

創(chuàng)新互聯(lián)公司服務(wù)項目包括惠水網(wǎng)站建設(shè)、惠水網(wǎng)站制作、惠水網(wǎng)頁制作以及惠水網(wǎng)絡(luò)營銷策劃等。多年來,我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢、行業(yè)經(jīng)驗、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,惠水網(wǎng)站推廣取得了明顯的社會效益與經(jīng)濟效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到惠水省份的部分城市,未來相信會繼續(xù)擴大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!
1、訪問權(quán)限
讀取r:允許查看文件內(nèi)容、顯示目錄列表;
寫入w:允許修改文件內(nèi)容,允許在目錄中新建、移動、刪除文件或子目錄;
可執(zhí)行x:允許運行程序、切換目錄
2、歸屬(所有權(quán))
屬主:擁有該文件或目錄的用戶賬號;
屬組:擁有該文件或目錄的組賬號;
3、查看文件的權(quán)限和歸屬
4、chmod設(shè)置文件權(quán)限
chmod命令的基本語法格式如下:
應(yīng)用舉例:
[root@centos01 ~]# touch 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 [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設(shè)置文件的歸屬
chown命令的基本語法格式如下:
應(yīng)用舉例:
[root@centos01 ~]# chown bob 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 [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 [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
二、目錄的權(quán)限和歸屬
1、訪問權(quán)限
2、歸屬(所有權(quán))
屬主:擁有該目錄的用戶賬號;
屬組:擁有該目錄的組賬號;
3、chmod設(shè)置目錄權(quán)限
chmod命令設(shè)置目錄權(quán)限的基本格式如下:
應(yīng)用舉例:
[root@centos01 ~]# chmod -R 755 benet/
[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
drwxr-xr-x 3 root root 18 1月 11 22:39 benet
-rw-r--r--. 1 root root 1603 10月 23 23:36 initial-setup-ks.cfg4、chown設(shè)置目錄的歸屬
chown命令設(shè)置目錄歸屬的基本格式如下:
應(yīng)用舉例:
[root@centos01 ~]# chown -R bob:benet benet/ [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 drwxr-xr-x 3 bob benet 18 1月 11 22:39 benet -rw-r--r--. 1 root root 1603 10月 23 23:36 initial-setup-ks.cfg
三、權(quán)限掩碼umask
1、umask的作用
控制新建的文件或目錄的權(quán)限,默認(rèn)權(quán)限去除umask的權(quán)限就是新建的文件或者目錄的權(quán)限。
2、設(shè)置umask
umask 022
3、查看umask
umask
4、應(yīng)用舉例:
[root@centos01 ~]# umask 0022 [root@centos01 ~]# umask 000 [root@centos01 ~]# umask 0000 [root@centos01 ~]# touch 2.txt [root@centos01 ~]# ll 總用量 8 -rwxr-xr-x 1 bob benet 0 1月 17 03:48 1.txt -rw-rw-rw- 1 root root 0 1月 17 03:48 2.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 ~]# umask 022 [root@centos01 ~]# umask 0022 [root@centos01 ~]# touch 3.txt [root@centos01 ~]# ll 總用量 8 -rwxr-xr-x 1 bob benet 0 1月 17 03:48 1.txt -rw-rw-rw- 1 root root 0 1月 17 03:48 2.txt -rw-r--r-- 1 root root 0 1月 17 03:49 3.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
本篇文章到此結(jié)束,如果您有相關(guān)技術(shù)方面疑問可以聯(lián)系我們技術(shù)人員遠程解決,感謝大家支持本站!
創(chuàng)新互聯(lián)網(wǎng)絡(luò)推廣網(wǎng)站建設(shè),網(wǎng)站設(shè)計,網(wǎng)站建設(shè)公司,網(wǎng)站制作,網(wǎng)頁設(shè)計,1500元定制網(wǎng)站優(yōu)化全包,先排名后付費,已為上千家服務(wù),聯(lián)系電話:13518219792
本文名稱:Linux文件/目錄的權(quán)限及歸屬管理使用
網(wǎng)頁地址:http://www.5511xx.com/article/dpjpgsh.html


咨詢
建站咨詢
