Provided by: manpages-zh_1.6.3.6-1_all bug

名稱

       chown - 更改檔案屬主與屬組

概述

       chown [選項]... [所有者][:[]] 檔案...
       chown [選項]... --reference=參考檔案 檔案...

描述

       This  manual  page  documents the GNU version of chown.  chown changes the user and/or group ownership of
       each given file.  If only an owner (a user name or numeric user ID) is given, that user is made the owner
       of each given file, and the files' group is not changed.  If the owner is followed by a colon and a group
       name (or numeric group ID), with no spaces between them, the group ownership of the files is  changed  as
       well.   If  a colon but no group name follows the user name, that user is made the owner of the files and
       the group of the files is changed to that user's login group.  If the colon and group are given, but  the
       owner  is omitted, only the group of the files is changed; in this case, chown performs the same function
       as chgrp.  If only a colon is given, or if the entire operand is empty, neither the owner nor  the  group
       is changed.

選項

       修改每個檔案的所有者和/或所屬組為給定的所有者和/或組。如同時使用  --reference,將每個給定檔案的所有者和屬
       組修改為參考檔案所具有的對應值。

       -c, --changes
              類似 verbose 選項,但僅在做出修改時進行報告

       -f, --silent, --quiet
              不顯示大多數錯誤訊息

       -v, --verbose
              輸出各個處理的檔案的診斷資訊

       --dereference
              影響每個符號連結的原始引用檔案(這是預設行為),而非符號連結本身

       -h, --no-dereference
              隻影響符號連結,而非被引用的任何檔案(僅當系統支援更改符號連結的所有者時,該選項才有用)

       --from=當前所有者:當前所屬組
              只當每個檔案的所有者和組符合選項所指定時才更改所有者和組。其中一個可以省略,這時已省略的屬性就不需
              要符合原有的屬性

       --no-preserve-root
              不特殊對待“/”(預設行為)

       --preserve-root
              不允許在“/”上遞迴操作

       --reference=參考檔案
              使用指定參考檔案的所有者和所屬組資訊,而非手工指定 所有者:組 的值

       -R, --recursive
              遞迴操作檔案和目錄

       以下選項是在指定了 -R  選項時被用於設定如何遍歷目錄結構體系。如果您指定了多於一個選項,那麼只有最後一個會
       生效。

       -H     如果命令列引數是一個指向目錄的符號連結,則對其進行遍歷

       -L     遍歷每一個遇到的指向目錄的符號連結

       -P     不遍歷任何符號連結(預設)

       --help 顯示此幫助資訊並退出

       --version
              顯示版本資訊並退出

       如果沒有指定所有者,則不會更改所有者資訊。若所屬組若沒有指定也不會對其更改,但當加上  ':' 時 GROUP 會更改
       為指定所有者的主要組。所有者和所屬組可以是數字或名稱。

範例

       chown root /u
              將 /u 的屬主更改為"root"。

       chown root:staff /u
              和上面類似,但同時也將其屬組更改為"staff"。

       chown -hR root /u
              將 /u 及其子目錄下所有檔案的屬主更改為"root"。

作者

       由 David MacKenzie 和 Jim Meyering 編寫。

報告錯誤

       GNU coreutils 的線上幫助: <https://www.gnu.org/software/coreutils/>
       請向 <https://translationproject.org/team/zh_CN.html> 報告翻譯錯誤。

版權

       Copyright  ©  2020  Free  Software  Foundation,  Inc.   License  GPLv3+:  GNU  GPL  version  3  or  later
       <https://gnu.org/licenses/gpl.html>.
       This  is  free software: you are free to change and redistribute it.  There is NO WARRANTY, to the extent
       permitted by law.

參見

       chown(2)

       完整文件請見: <https://www.gnu.org/software/coreutils/chown>
       或者在本地使用: info '(coreutils) chowns invocation'

       本頁面中文版由中文 man 手冊頁計劃提供。
       中文 man 手冊頁計劃:https://github.com/man-pages-zh/manpages-zh

GNU coreutils 8.32                                 2020年三月                                           CHOWN(1)