chown
linuxchownは、ファイルやディレクトリの所有者、又はグループを変更する。
[user@centos7 ~]$ chown ユーザーorグループ名 ファイル名
option
| -c | 所有者が変更されたファイルのみ詳細を表示 |
|---|---|
| -f | 所有者が変更できなかった場合でも、エラーメッセージを表示しない |
| -h | シンボリックリンク自体の所有者を変更 |
| -v | 所有者を変更した際の実行結果を表示 |
| -R | ディレクトリ内すべての所有者を変更 |
| ユーザー名:グループ名 | 指定した所有者とグループ名へ変更 |
example of use
[root@centos7 ~]# ls -l
-rw-r--r-- 1 user root 560 5月 30 22:00 text.txt
[root@centos7 ~]# chown root text.txt
[root@centos7 ~]# ls -l
-rw-r--r-- 1 root root 560 5月 30 22:00 text.txt
所有者をrootへ変更。