Linux命令-許可權管理命令:chmod

來源:互聯網
上載者:User

標籤:

特別注意:在linux中,目錄通常是有r和x兩個許可權的。刪除檔案的前題是要對檔案所在的目錄有w的許可權才可以。

cd /tmp    切換到tmp目錄下面touch chengshi.list   在目前的目錄中建立chengshi.list檔案ls -l chengshi.list   查看目前的目錄中的chengshi.list檔案的長格式資訊

chmod u+x chengshi.list  給chengshi.list檔案的所有者增加執行許可權

chmod g+w,o-r chengshi.list  設定chengshi.list檔案的所屬組許可權增加w,同時將它的其他人許可權去掉r

chmod g=rwx chengshi.list  將chengshi.list檔案的所屬組的使用權限設定為rwx,不管它之前的許可權是什麼,現在統一改稱rwx

許可權還可以使用數位方式來表示

chmod 640 chengshi.list  6表示rw-,4表示r--,0表示---

mkdir -p /tmp/a/b    遞迴建立tmp目錄下的a目錄,和a目錄下的b目錄ls -ld /tmp/a  顯示a目錄許可權ls -ld /tmp/a/b  顯示b目錄許可權chmod -R 777 /tmp/a  遞迴修改tmp目錄下面a目錄下面所有目錄和檔案的許可權為777ls -ld /tmp/a  顯示a目錄許可權ls -ld /tmp/a/b  顯示b目錄許可權

Linux命令-許可權管理命令:chmod

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.