One linux command per day (30): chown command

Command name: chown Permission: root   

How to use: chown [-cfhvR] [--help] [--version] user[:group] file...  

Use chown to change the owner of the file. This command is only used by the system administrator (root). Generally, users do not have permission to change other people's file owners,
nor do they have permission to change their own file owners to others. Only the system administrator (root) has such privileges.

Parameters:
-c or -change: similar to -v, but only return the modified part
-f or -quiet or -silent: do not display error messages -h or -no-dereference: only modify the file of the symbolic link , without changing any other related files -R or -recursive: recursive processing, process all files and subdirectories in the specified directory together -v or -verbose: display the instruction execution process
-dereference: the effect is just the opposite of -h
- help: display online instructions
–reference=<reference file or directory>: set the owner and group of the specified file or directory to be the same as the owner and group of the reference file or directory 
–version: display version information

chown command Example of use:
chown [-R] [user name] [file or directory]
chown[-R] [user name:group name] [file or directory]

Example Change the permissions and groups of
the rootfs folder and its subdirectories to root
chown –R root:root rootfs
Change the owner and group of the directory rootfs folder and subdirectories to user liufan and group liufan-desktop
chown -R liufan:liufan-desktop rootfs


chown ksea /usr/local/elasticsearch -R
Authorize this user for ksea


Reference:
http http://www.cnblogs.com/peida/archive/2012/12/04/2800684.html
http://www.360doc.com/content/12/0702/17/7909375_221744897.shtml

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326296534&siteId=291194637