svcadm(8)을 검색하려면 섹션에서 8 을 선택하고, 맨 페이지 이름에 svcadm을 입력하고 검색을 누른다.
chown(1)
chown(1) User Commands chown(1)
NAME
chown - change file ownership
SYNOPSIS
/usr/bin/chown
chown [-c | -changes] [--dereference] [-h | --no-dereference]
[--from=current_owner:current_group] [-f | --silent | --quiet]
[--help] [--preserve-root] [--no-preserve-root] [-v | --verbose]
{--reference=rfile | owner[:group]} file...
chown {-R | -recursive} [-H | -L | -P]
[-c | -changes] [--dereference] [-h | --no-dereference]
[--from=current_owner:current_group] [-f | --silent | --quiet]
[--help] [--preserve-root] [--no-preserve-root] [-v | --verbose]
{--reference=rfile | owner[:group]} file...
chown -s [-c | -changes] [--dereference] [-h | --no-dereference]
[--from=current_owner:current_group] [-f | --silent | --quiet]
[--help] [--preserve-root] [--no-preserve-root] [-v | --verbose]
ownersid[:groupsid] file...
chown -s {-R | -recursive} [-H | -L | -P]
[-c | -changes] [--dereference] [-h | --no-dereference]
[--from=current_owner:current_group] [-f | --silent | --quiet]
[--help] [--preserve-root] [--no-preserve-root] [-v | --verbose]
ownersid[:groupsid] file...
/usr/xpg4/bin/chown
/usr/xpg4/bin/chown [-fhR] owner[:group] file...
/usr/xpg4/bin/chown -s [-fhR] ownersid[:groupsid] file...
/usr/xpg4/bin/chown -R [-f] [-H | -L | -P] owner[:group] file...
/usr/xpg4/bin/chown -s -R [-f] [-H | -L | -P] ownersid[:groupsid] file...
DESCRIPTION
/usr/bin/chown and /usr/xpg4/bin/chown
The chown utility sets the user ID of the file named by each file to
the user ID specified by owner, and, optionally, sets the group ID to
that specified by group.
If chown is invoked without the {PRIV_FILE_SETID} privilege, the set-
user-ID and set-group-ID bits are cleared.
Changing the owner of a file may require additional privilege. The
{PRIV_FILE_CHOWN} privilege allows changing the owner of files owned by
other users, but does not allow changing the owner to or from uid 0.
The {PRIV_FILE_CHOWN_SELF} privilege allows the file's current owner to
change the owner to another uid, except for uid 0. Changing a file's
owner to uid 0 requires all privileges.
The file system has a mountpoint option, rstchown, to restrict owner‐
ship changes. When this option is in effect the owner of the file is
prevented from changing the owner ID of the file, unless they use the
privileges listed above. When this option is not in effect, the owner
of the file does not need additional privilege to change the owner to
another non-zero uid. The _POSIX_CHOWN_RESTRICTED option will be re‐
ported as true for paths on filesystems mounted with the rstchown op‐
tion, when checked with fpathconf(2) or getconf(1).
chown changes the ownership of each file to owner. owner can be speci‐
fied as either a user name or a numeric user id. The group ownership of
each file can also be changed to group by appending :group to the user
name.
OPTIONS
All of the following options are supported for /usr/bin/chown, while
/usr/xpg4/bin/chown only accepts a subset: -f, -h, -H, -L, -P, -R, and
-s.
-c, --changes
Like verbose (-v | --verbose). Reports only when a change is made.
--dereference
If the file is a symbolic link, the owner of the file referenced by
the symbolic link is changed. This is the default behavior. If both
--dereference and -h or --no-dereference are specified, the last
option listed determines the behavior of chown.
-f, --silent, --quiet
Force. Does not report errors.
--from=current_owner:current_group
Change the owner and/or group of each file only if its current
owner and/or group match those specified here. Either may be omit‐
ted, in which case a match is not required for the omitted at‐
tribute
-h, --no-dereference
If the file is a symbolic link, this option changes the owner of
the symbolic link. Without this option, the owner of the file ref‐
erenced by the symbolic link is changed.
--help
Display usage message and exit.
-H
If the file specified on the command line is a symbolic link refer‐
encing a file of type directory, this option changes the owner of
the directory referenced by the symbolic link and all the files in
the file hierarchy below it. If a symbolic link is encountered when
traversing a file hierarchy, the owner of the target file is
changed, but no recursion into the target of the link takes place.
-L
If the file is a symbolic link, this option changes the owner of
the file referenced by the symbolic link. If the file specified on
the command line, or encountered during the traversal of the file
hierarchy, is a symbolic link referencing a file of type directory,
then this option changes the owner of the directory referenced by
the symbolic link and all files in the file hierarchy below it.
--no-preserve-root
Do not treat '/' specially. This is the default.
--preserve-root
Do not operate recursively on '/'.
-P
If the file specified on the command line or encountered during the
traversal of a file hierarchy is a symbolic link, this option
changes the owner of the symbolic link. This option does not follow
the symbolic link to any other part of the file hierarchy.
--reference=rfile
Uses rfile's owner and group. If rfile is missing, then gives a di‐
agnostic error message and returns a non-zero exit code. This op‐
tion and -s option are mutually exclusive.
-R, --recursive
Recursive. chown descends through the directory, and any subdirec‐
tories, setting the specified ID as it proceeds. When a symbolic
link is encountered, the owner of the target file is changed, un‐
less the -h or -P option is specified. However, no recursion into
the target of the link takes place, unless the -H or -L option is
specified.
The behavior of the -R option to /usr/xpg4/bin/chown differs from
that of /usr/bin/chown as follows.
If the file specified on the command line is a symbolic link refer‐
encing a file of type directory, /usr/xpg4/bin/chown will always
recurse through the target directory if this option is specified,
while /usr/bin/chown will only do so if either -H or -L is also
specified.
If a file encountered during the traversal of the file hierarchy is
a symbolic link referencing a file of type directory, then
/usr/xpg4/bin/chown will recurse through the target directory if
this option is specified, unless the -h, -H, or -P is also speci‐
fied; while /usr/bin/chown will only do so if -L is also specified.
Effectively, the -L option is enabled by default when running
/usr/xpg4/bin/chown unless overridden by another option.
-s
The owner and/or group arguments are Windows SID strings. This op‐
tion requires a file system that supports storing SIDs, such as
ZFS. This option and --reference option are mutually exclusive.
-v, --verbose
Give a diagnostic for every file processed.
If more than one of the -H, -L, or -P options is specified, the last
option specified determines the behavior of chown, and the previous op‐
tions are ignored.
The -H, -L, and -P options require the -R option to also be specified.
These options cannot be used in conjunction with either the -h or --no-
dereference options.
OPERANDS
The following operands are supported:
owner[:group] A user ID and optional group ID to be assigned to
file. The owner portion of this operand must be a user
name from the user database or a numeric user ID. Ei‐
ther specifies a user ID to be given to each file
named by file. If a numeric owner exists in the user
database as a user name, the user ID number associated
with that user name is used as the user ID. Similarly,
if the group portion of this operand is present, it
must be a group name from the group database or a nu‐
meric group ID. Either specifies a group ID to be
given to each file. If a numeric group operand exists
in the group database as a group name, the group ID
number associated with that group name is used as the
group ID.
file A path name of a file whose user ID is to be modified.
EXAMPLES
Example 1 Changing Ownership of All Files in the Hierarchy
The following command changes ownership of all files in the hierarchy,
including symbolic links, but not the targets of the links:
example% chown −R −h owner[:group] file...
ENVIRONMENT VARIABLES
See environ(7) for descriptions of the following environment variables
that affect the execution of chown: LANG, LC_ALL, LC_CTYPE, LC_MES‐
SAGES, and NLSPATH.
EXIT STATUS
The following exit values are returned:
0 The utility executed successfully and all requested changes were
made.
>0 An error occurred.
ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
/usr/bin/chown
tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
TRIBUTE VALUE _ Availabilitysystem/core-os _ CSIEnabled. See below. _
Interface StabilityCommitted _ StandardSee standards(7).
/usr/xpg4/bin/chown
tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
TRIBUTE VALUE _ Availabilitysystem/xopen/xcu4 _ CSIEnabled. See below.
_ Interface StabilityCommitted _ StandardSee standards(7).
chown is CSI-enabled except for the owner and group names.
SEE ALSO
chgrp(1), chmod(1), getconf(1), chown(2), fpathconf(2), passwd(5), at‐
tributes(7), environ(7), privileges(7), standards(7), mount(8)
HISTORY
Support for the -c, --changes, --dereference, --no-dereference, --from,
--help, --preserve-root, --no-preserve-root, --quiet, --recursive,
--reference, --silent, -v, and --verbose options was added in Oracle
Solaris 11.4.0.
Support for the -H, -L, and -P options was added in the Solaris 10 re‐
lease, along with the /usr/xpg4/bin/chown command.
Support for changing the group by including :group in the operand was
added in the Solaris 2.5 release.
Support for the -h option was added in the Solaris 2.0 release. The So‐
laris 2.0 release also dropped support for changing the group via the
/usr/bin/chown command.
In releases of Solaris from Solaris 2.0 through Oracle Solaris 11.3,
there was a /usr/ucb/chown command which had different -R semantics
with respect to how symbolic links were handled. /usr/ucb/chown changed
ownership of the symbolic link but not the target file. To get this be‐
havior with /usr/bin/chown, the -P flag needs to be specified. This
version of chown also used "." instead of ":" as the separator between
the owner and group arguments. This command was provided as /etc/chown
in Solaris 1.x releases.
The chown command, with support for the -f and -R options, has been
present in all Sun and Oracle releases of Solaris.
Oracle Solaris 11.4 29 Nov 2022 chown(1)