chown
From Wikipedia, the free encyclopedia
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,[citation needed] it can only be executed by the superuser, to prevent users simply changing ownership of files that aren't their's to access them. Unprivileged (regular) users who wish to change the group of a file that they own may use chgrp.
[edit] Usage examples
These examples illustrate typical syntax and use. Modifying permissions requires you are either root or have write access to the file. Changing owner requires root privilege.
- Change the owner of
/var/run/httpd.pidto 'root' (the standard name for the Superuser).
# chown root /var/run/httpd.pid
- Change the owner of
strace.logto 'rob' and the group identifier to 'developers'.
# chown rob:developers strace.log
- Change the owner of
/tmpand/var/tmpto ‘nobody’ (not a good idea), and change the group of/tmpand/var/tmpto ‘nogroup’
# chown nobody:nogroup /tmp /var/tmp
- Change the group identifier of
/hometo 512 (regardless of whether a group name is associated with the identifier 512 or not).
# chown :512 /home
- Change the ownership of
baseto the userfoouserand make it recursive (-R)
# chown -R foouser base
- Change the ownership to newuser and group to newgroup for all of the files and directories in current directory, and all subdirectories (recursively).
# chown -R newuser:newgroup .
[edit] See also
[edit] External links
- – Commands & Utilities Reference, The Single UNIX® Specification, Issue 7 from The Open Group
- chown manual page
- The chown Command by The Linux Information Project (LINFO)
|
||||||||||||||||||||||||||||||||