What is the command to change file owner in linux

Release: 2020-05-12 17:08:29
Original
6849 people have browsed it

What is the command to change file owner in linux

In Linux, you can use the chown command 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; File is a space-separated list of files whose permissions need to be changed. Wildcards are supported.

Command syntax:

chown [-R] 所有者名称 文件或者目录
Copy after login

-R: Make recursive and continuous changes. That is to say, all files and directories under the subdirectory are updated to become this user group. It is often used to change the status of all files in a certain directory.

Example:

[root@shuai shan]# ls -al
-rw-r--r--  1 root root    0 8月  19 12:37 six.log
[root@shuai shan]# chown shan six.log
[root@shuai shan]# ls -al
-rw-r--r--  1 shan shan    0 8月  19 12:37 six.log
Copy after login

Recommended learning:Linux video tutorial

The above is the detailed content of What is the command to change file owner in linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template