Linux學習筆記二之許可權管理命令

來源:互聯網
上載者:User


Linux學習筆記二之許可權管理命令 相關連結:Linux學習筆記一之檔案操作命令http://www.bkjia.com/os/201211/169196.html 1、chmod命令,改變檔案或目錄的許可權 第一種方法:  www.2cto.com   u--所有者   g--所屬組  o--其他人 chmod u +wx chmod g -r chmod o =rwx 執行前許可權644:-rw-r--r--. 1 root root 0 11月 18 17:20 dd.txt     執行[root@CentOS-Test bak]# chmod u=rwx dd.txt 執行後限744:-rwxr--r--. 1 root root 0 11月 18 17:20 dd.txt  第二種方法: rwx--可讀可寫可執行  用數字來表示:r-4  w-2  x-1 [root@CentOS-Test bak]# chmod 777 dd.txt -rwxrwxrwx. 1 root root 0 11月 18 17:20 dd.txt [root@CentOS-Test bak]# chmod 641 dd.txt -rw-r----x. 1 root root 0 11月 18 17:20 dd.txt 注意:對rwx檔案許可權的理解 r:表示對檔案可以查看內容,對目錄則可以列出檔案的名字 w:表示對檔案可以寫內容,對目錄可以建立和刪除 x:表示對檔案可以執行命令和指令碼 2、chown命令,改變檔案或目錄的所有者   [root@CentOS-Test data]# chown test bak   drwxr-x--x. 2 test root  1024 11月 18 17:37 bak3、umask修改檔案或檔案夾的預設許可權 查看系統預設的許可權即預設建立檔案的許可權: [root@CentOS-Test data]# umask -S u=rwx,g=rx,o=rx [root@CentOS-Test data]# umask 0022(許可權掩碼值)   0:特殊權限類別  022:使用者權限位,是一個掩碼值,最終許可權是777-022=755 linux許可權規則:預設建立的檔案不具有可執行許可權 [root@CentOS-Test data]#touch cc.txt [root@CentOS-Test data]# ll cc.txt -rw-r--r--. 1 root root 11 11月 18 17:59 cc.txt 改變檔案預設建立的許可權:使用777-要產生的預設許可權=掩碼值,預設許可權最好不要改變 [root@CentOS-Test data]#umask 掩碼值 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.