English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Linux chown (full English spelling:change owner)is a command used to set the file owner and the file's associated group.
Linux/Unix is a multi-user, multi-tasking operating system, with all files having owners. The 'chown' command is used to change the owner of a specified file to a specified user or group; the user can be a username or user ID, and the group can be a group name or group ID. The file list to change permissions is separated by spaces, and wildcard characters are supported. .
The 'chown' command requires superuser root privileges to execute this command.
Only superusers and the file owners belonging to the group can change the file's associated group. Non-superusers who need to set an associated group may need to use chgrp Command.
Permissions : root
chown [-cfhvR] [--help] [--version] user[:group] file...
Parameters :
user : New file owner's user ID
group : New file owner's user group (group)
-c : Display information about the parts changed
-f : Ignore error information
-h : Repair symbolic links
-v : Display detailed processing information
-R : Process all files in the specified directory and its subdirectories
--help : Display help information
--version : Display version
Take /var/run/Owner of httpd.pid set to root:
chown root /var/run/httpd.pid
Set the owner of the file file1Owner of .txt set to w3codebox, the user of the group w3codeboxgroup :
chown w3codebox:w3codeboxgroup file1.txt
Set the owner of all files and subdirectories under the current directory to w3codebox, the user of the group w3codeboxgroup:
chown -R w3codebox:w3codeboxgroup *
Take /home/w3The associated group of codebox is set to 512 Group ID associated, do not change the owner:
chown :512 /home/w3codebox