Isilon: How to change a file owner
Summary: This article summarizes the commands to modify the user and/or group ownership in OneFS 8+
Instructions
Synopsis:
chown [OPTIONS] USER[:GROUP] FILEs
USER is the username or the user ID (UID) of the new owner. GROUP is the name of the new group or the group ID (GID). FILE(s) is the name of one or more files, directories, or links. Numeric IDs should be prefixed with the + symbol.
USER- If only the user is specified, the specified user becomes the owner of the given files, the group ownership is not changed.USER:- When the username is followed by a colon:, and the group name is not given, the user will become the owner of the files, and the files group ownership is changed to user’s login group.USER:GROUP- If both the user and the group are specified (with no space between them), the user ownership of the files is changed to the given user and the group ownership is changed to the given group.:GROUP- If the User is omitted and the group is prefixed with a colon:, only the group ownership of the files is changed to the given group.:If only a colon:is given, without specifying the user and the group, no change is made.
By default, on success, chown does not produce any output and returns zero.
How to Change the Owner of a File.
To change the owner of a file use the chown command followed by the username of the new owner and the target file as an argument:
# chown USER FILE
To change the ownership of multiple files or directories, specify them as a space-separated list. The command below changes the ownership of a file named file1 and directory dir1 to a new owner named test:
# chown test file1 dir1
How to Change the Group of a File.
To change only the group of a file use the chown command followed by a colon (:) and the new group name (with no space between them) and the target file as an argument:
# chown :GROUP FILE
How to Change the Owner and Group of a File.
To change both the owner and the group of a file use the chown command followed by the new owner and group separated by a colon (:) with no intervening spaces and the target file.
# chown USER:GROUP FILE
If you omit the group name after the colon (:) the group of the file is changed to the specified user’s login group:
Notes
> chgrp command can also be used to change the owner group.
> Use the below option to make the changes recursive.
-R, --recursive
Operate on files and directories recursively.
> The numeric user ID (UID) can be used instead of the username.
> To check all command's options and additional information type #man chown in your terminal.
Examples
# chown root /u
Change the owner of /u to "root".
# chown root:staff /u
Likewise, but also change its group to "staff".
# chown -hR root /u
Change the owner of /u and subfiles to "root".