- chown
-
For the surname, see Chown (surname).
The chown command (abbreviation for change owner) 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.
Usage examples
These examples illustrate typical syntax and use. Because chown modifies permissions, it usually requires root privilege to run.
# chown root /var/run/httpd.pid
- Change the owner of
/var/run/httpd.pid
to 'root' (the standard name for the Superuser).
# chown rob:developers strace.log
- Change the owner of
strace.log
to 'rob' and the group identifier to 'developers'.
# chown nobody:nogroup /tmp /var/tmp
- Change the owner of
/tmp
and/var/tmp
to ‘nobody’ (not a good idea) - Change the group of
/tmp
and/var/tmp
to ‘nogroup’
# chown :512 /home
- Change the group identifier of
/home
to 512 (regardless of whether a group name is associated with the identifier 512 or not).
# chown -R us base
- Change the ownership of
base
to the userus
and make it recursive (-R
)
# chown -R newuser:newgroup .
- Change the ownership to newuser and group to newgroup for all of the files and directories in current directory, and all subdirectories (recursively).
See also
External links
- The Single UNIX® Specification, Issue 7 from The Open Group – Commands & Utilities Reference,
- chown manual page
- The chown Command by The Linux Information Project (LINFO)
Unix command-line interface programs and shell builtins (more) File system Processes User environment Text processing Shell builtins Networking Searching Documentation Miscellaneous Categories:- Operating system security
- Standard Unix programs
- Unix SUS2008 utilities
- Change the owner of
Wikimedia Foundation. 2010.