| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
chown: Change file owner and group
chown changes the user and/or group ownership of each given file
to new-owner or to the user and group of an existing reference file.
Synopsis:
chown [option]... {new-owner | --reference=ref_file} file...
|
If used, new-owner specifies the new owner and/or group as follows (with no embedded white space):
[owner] [ [:] [group] ] |
Specifically:
chown performs the same function as chgrp.
You may use `.' in place of the `:' separator. This is a
GNU extension for compatibility with older scripts.
New scripts should avoid the use of `.' because GNU chown
may fail if owner contains `.' characters.
The program accepts the following options. Also see 2. Common options.
root might run
find / -owner OLDUSER -print0 | xargs -0 chown NEWUSER |
But that is dangerous because the interval between when the find
tests the existing file's owner and when the chown is actually run
may be quite large.
One way to narrow the gap would be to invoke chown for each file
as it is found:
find / -owner OLDUSER -exec chown NEWUSER {} \;
|
But that is very slow if there are many affected files. With this option, it is safer (the gap is narrower still) though still not perfect:
chown -R --from=OLDUSER NEWUSER / |
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'.
lchown system call, and `--no-dereference'
is in effect, then issue a diagnostic saying neither the symbolic link nor
its referent is being changed.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |