fortypoundhead.com

CHOWN

Posted On 2007-04-27 by FortyPoundHead
Keywords: Command Reference
Tags: Linux Commandline Linux
Views: 1464


Change owner, change the user and/or group ownership of each given File to a new Owner.
Chown can also change the ownership of a file to match the user/group of an existing reference file.

SYNTAX
chown [Options]... NewOwner File...

chown [Options]... :Group File...

chown [Options]... --reference=RFILE File...

If used, NewOwner specifies the new owner and/or group as follows
(with no embedded white space):

[OWNER] [ [:.] [GROUP] ]

Some examples of how the owner/group can be specified:

OWNER
If only an OWNER (a user name or numeric user id) is given, that
user is made the owner of each given file, and the files'' group is
not changed.

OWNER.GROUP
OWNER:GROUP
If the OWNER is followed by a colon or dot and a GROUP (a group
name or numeric group id), with no spaces between them, the group
ownership of the files is changed as well (to GROUP).

OWNER.
OWNER:
If a colon or dot but no group name follows OWNER, that user is
made the owner of the files and the group of the files is changed
to OWNER''s login group.

.GROUP
:GROUP
If the colon or dot and following GROUP are given, but the owner
is omitted, only the group of the files is changed; in this case,
`chown'' performs the same function as `chgrp''.

OPTIONS:

-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.


About the Author

FortyPoundHead has posted a total of 1974 articles.

 


Comments On This Post

No comments on this post yet!


Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.


Your IP address is:107.22.56.104

Before you can post, you need to prove you are human. If you log in, this test goes away.



Recent Forum Posts

SSL Now Active
dwirch posted on June 16, 2017 at about 8:40 in Site News

SSL Now Active
dwirch posted on June 13, 2017 at about 7:59 in Site News

Coding Archive?
dwirch posted on June 3, 2017 at about 12:54 in Site News

Job Spammer: Bharti Jigyasi
dwirch posted on June 2, 2017 at about 16:57 in Spammers

Coding Archive?
dwirch posted on May 25, 2017 at about 12:38 in Site News

BWASL returns
dwirch posted on May 13, 2017 at about 15:24 in Site News