Linux命令(八)許可權管理chown、chgrp、chmod、umask

來源:互聯網
上載者:User

標籤:

許可權管理:
r:
w:
x:

三類使用者:
u: 屬主
g: 屬組
o: 其它使用者

 

chown:改變檔案屬主(只有管理員可以使用此命令)

  -R: 修改目錄及其內部檔案的屬主

  --reference=/path/to/somefile file,...參考某個檔案,設定相關檔案許可權為參考檔案許可權,同時改屬主,屬組chown USERNAME:GROUP file

chgrp:

chmod:修改檔案的許可權

  修改三類使用者的許可權:

    -R
    --reference=/path/to/somefile file,...

  修改某類使用者或某些類使用者權限:

    u,g,o,a

    chmod u=rwx,g=,o= file

  修改某類使用者的某位或某些位許可權:

    chmod u+x,g-x file

 

  通過改檔案的方式建立使用者

  nano /etc/group

  nano /etc/passwd

  nano /etc/shadow

  cp -r /etc/skel/ /home/hive/

  chown -R hive:hive /home/hive

umask:遮罩碼

  666-umask
  777-umask

  檔案預設不能具有執行許可權,如果算得的結果中有執行許可權,則將其許可權加1;

  umask: 023
  檔案:666-023=643 + 1
  目錄:777-023=754

Linux命令(八)許可權管理chown、chgrp、chmod、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.