A command to change the ownership of a user or group of files or directories.
$ chown [option]User or group file or directory
$ ls -l
#=> -rw-rw-r— 1 sample sample 47 May 21 08:42 test1.htmle.erb
$ chown root test1.htmle.erb
$ ls -l
#=> -rw-rw-r— 1 root samurai 47 May 21 08:42 test1.htmle.erb
$ chown root:root test1.htmle.erb
$ ls -l
#=> -rw-rw-r— 1 root root 47 May 21 08:42 test1.htmle.erb
| option | Explanation |
|---|---|
| -c | Show details if owner information changes |
| -f | Do not display error message |
| -h | Also change ownership of symbolic links |
| -R | Also change ownership in the directory |
| -v | Display details of owner change information (even if not changed) |
Recommended Posts