Unix-commands-chown
提供:Dev Guides
chown-Unix、Linuxコマンド
NAME
概要
説明
NewOwnerを使用する場合、次のように新しい所有者またはグループ、あるいはその両方を指定します(埋め込み空白なし):
所有者/グループを指定する方法の例を次に示します。
- OWNER(ユーザー名または数値のユーザーID)のみが指定されている場合、そのユーザーは指定された各ファイルの所有者になり、ファイルのグループは変更されません。
- OWNERの後にコロンまたはドットとGROUP(グループ名または数値グループID)が続き、それらの間にスペースがない場合、ファイルのグループ所有権も(GROUPに)変更されます。
- OWNERの後にグループ名がないコロンまたはドットがある場合、そのユーザーがファイルの所有者になり、ファイルのグループがOWNERのログイングループに変更されます。
- コロンまたはドットとそれに続くGROUPが指定されていて、所有者が省略されている場合、ファイルのグループのみが変更されます。この場合、「chown」は「chgrp」と同じ機能を実行します。
オプション
Tag | Description |
---|---|
-c—changes | Verbosely describe the action for each File whose ownership actually changes. |
--dereference | Do not act on symbolic links themselves but rather on what they point to. |
-f—silent—quiet | Do not print error messages about files whose ownership cannot be changed. |
-h—no-dereference | Act on symbolic links themselves instead of what they point to. This is the default. This mode relies on the 'lchown' system call. On systems that do not provide the 'lchown' system call, 'chown' fails when a file specified on the command line is a symbolic link. By default, no diagnostic is issued for symbolic links encountered during a recursive traversal, but see '--verbose'. |
--reference=FILE | Use the user and group of the reference FILE instead of an explicit NewOwner value. |
-R—recursive | Recursively change ownership of directories and their contents. |
-v—verbose | Verbosely describe the action (or non-action) taken for every FILE. If a symbolic link is encountered during a recursive traversal on a system without the 'lchown' system call, and '--no-dereference' is in effect, then issue a diagnostic saying neither the symbolic link nor its referent is being changed. |
例
ファイルの所有者を変更します。
ファイルのグループを変更します。
単一のコマンドでファイルの所有者とグループの両方を変更します。
link:/cgi-bin/printpage.cgi [__印刷]