Home  >  Article  >  Operation and Maintenance  >  Share Linux-chown instruction usage examples

Share Linux-chown instruction usage examples

零下一度
零下一度Original
2017-06-25 10:12:122265browse

chown [chang owner]: Change the owner of the file, that is, change the owner of the specified file to another specified user or group.

Command format:

chown [option]... [user][:[group]] file...

Example: sudo chown book:book /work -R

-R[recursion]: Recursively change all files in the directory

Generally, no When using the above command, the subdirectory work is owned by the root user and root group.

Enter the ls -ld work command, and then list the details of the work directory. As can be seen from the figure below, the directory permissions are all managed by root.

After using sudo chown book:book /work -R, the work directory and all members in the work directory will belong to the book user and book group As shown below, enter the ls -ld work command again. You can see that the permissions of the work directory are managed by book, so that the book user can write files and read files.

The above is the detailed content of Share Linux-chown instruction usage examples. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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