Manpages

名 稱

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