In Linux, you can use the chown command to change the folder owner. This command is used to set the file owner and file association group. The syntax is "sudo chown owner name file name"; use chown to change the file. When folder owner, administrator rights are required, so sudo must be added before the command.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
How to change the folder owner in Linux
The owner of the file itself is generally the file creator. Of course, we can modify it through commands. . When the file creator creates a file, the group the creator belongs to is the group the file belongs to. Of course, this is not absolute. We can also modify the group through commands.
#When using the chown command, you need to use administrator privileges. Add sudo before the command. You can see that after changing the file owner to user abc, the group of the file is still zy. chown means change owner.
The general format of the command is as follows
sudo chown 拥有者名字 文件名
The Linux chown (English full spelling: change owner) command is used to set the file owner and file association group.
Linux/Unix is a multi-person, multi-tasking operating system, and all files have owners. Use chown to change the owner of the specified file to the specified user or group. The user can be the user name or user ID. The group can be the group name or group ID. The file is a space-separated list of files whose permissions need to be changed. Wildcards are supported. .
chown requires super user root permissions to execute this command.
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of How to change folder owner in linux. For more information, please follow other related articles on the PHP Chinese website!