Home > Article > Operation and Maintenance > Share Linux-chown instruction usage examples
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!