簡明Linux命令列筆記:chown

來源:互聯網
上載者:User
文章目錄
  • 參數
  • 選項
  • 樣本

改變檔案的所有者或與檔案相關聯的組

chown [options] owner file-list

chown [options] owner: group file-list

chown [options] owner: file-list

chown [options] :group file-list

 

參數

owner為新所有者對應的使用者名稱,file-list為要修改其所有者或相關聯組的檔案路徑名列表

所有者和組使用者的指定方式

參  數 意    義
owner file-list的新所有者;不改變組使用者
owner:group file-list的新所有者和相關連的新組
owner: file-list的新所有者;與file-list相關聯的組改變為新所有者的登入組
:group 與file-list相關聯的新組;不改變所有者

 

 

 

 

 

 

選項

-c              顯示更改的過程資訊

-v              顯示更改過後的資訊

-f               強制更改

-R              遞迴更改目錄

 

樣本chown owner
Darling work # ls -l總用量 0-rw-r--r-- 1 siu siu 0  1月 10 15:35 tempDarling work # chown jack temp Darling work # ls -l總用量 0-rw-r--r-- 1 jack siu 0  1月 10 15:35 temp

修改檔案所有者

 

chown owner:group
Darling work # ls -l總用量 0-rw-r--r-- 1 jack siu 0  1月 10 15:35 tempDarling work # chown jack:jack temp Darling work # ls -l總用量 0-rw-r--r-- 1 jack jack 0  1月 10 15:35 temp

修改檔案所有者和群組

 

chown -c :group
Darling work # ls -l總用量 0-rw-r--r-- 1 jack jack 0  1月 10 15:35 tempDarling work # chown -c :siu temp changed ownership of "temp" from jack:jack to :siuDarling work # ls -l總用量 0-rw-r--r-- 1 jack siu 0  1月 10 15:35 temp

修改檔案群組,並顯示修改的過程資訊

 

 

 

聯繫我們

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