Chown
Encyclopedia
The chown command is used on Unix-like
systems to change the owner of a file. In most implementations, it can only be executed by the superuser
. Unprivileged
(regular) users who wish to change the group of a file that they own may use chgrp
.
Unix-like
A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....
systems to change the owner of a file. In most implementations, it can only be executed by the superuser
Superuser
On many computer operating systems, the superuser is a special user account used for system administration. Depending on the operating system, the actual name of this account might be: root, administrator or supervisor....
. Unprivileged
Privilege (Computing)
In computing, privilege is defined as the delegation of authority over a computer system. A privilege is a permission to perform an action. Examples of various privileges include the ability to create a file in a directory, or to read or delete a file, access a device, or have read or write...
(regular) users who wish to change the group of a file that they own may use chgrp
Chgrp
The chgrp command is used by unprivileged users on Unix-like systems to change the group associated with a computer file...
.
Usage examples
These examples illustrate typical syntax and use. Because chown modifies permissions, it usually requires root privilege to run.- Change the owner of
/var/run/httpd.pid
to 'root' (the standard name for the Superuser).
- Change the owner of
strace.log
to 'rob' and the group identifier to 'developers'.
- Change the owner of
/tmp
and/var/tmp
to ‘nobodyNobody (username)In many Unix variants, "nobody" is the conventional name of a user account which owns no files, is in no privileged groups, and has no abilities except those which every other user has....
’ (not a good idea) - Change the group of
/tmp
and/var/tmp
to ‘nogroup’
- Change the group identifier of
/home
to 512 (regardless of whether a group name is associated with the identifier 512 or not).
- Change the ownership of
base
to the userus
and make it recursive (-R
)
- Change the ownership to newuser and group to newgroup for all of the files and directories in current directory, and all subdirectories (recursively).
External links
- chown manual page
- The chown Command by The Linux Information Project (LINFO)