How to authorize all the contents of a folder to a certain user in Linux?

How to authorize all the contents of a folder to a certain user in Linux?

【Problem Analysis】

We can use the chown command. ch here stands for change, and own stands for the English word owner. Together, they mean change owner, which changes the owner of a file or folder.

Generally, only the root user has permission to use this command, and it is also a frequently used command. Here comes the question! If I want to grant permission to a folder and all its sub-contents to the mysql user, how can I do this?

What about the operation?

【Solution】

We can add the -R parameter to achieve this

-R: Make the same owner change to all files and subdirectories in the current directory (i.e. change them one by one in a recursive manner)

For example: I want to authorize landui.com to the mysql user

This is the directory structure of landui.com

We authorize the entire folder to the mysql user

Let’s take a look at the current permissions.

We can see that all authorizations are successful, indicating that this parameter is available.

The above is a detailed introduction of how to authorize all the contents of a folder in Linux to a certain user. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • Linux Shell gets the names of all folders in a directory
  • Folder sharing and two-way copying between Virtualbox host and virtual machine (Windows<->Windows, Windows<->Linux)
  • Linux du command to view folder sizes and sort in descending order
  • Count the number of files and directories in the current folder under Linux
  • How to get the file name in the folder in Linux Shell
  • Linux commands to delete folders and files (forced deletion including non-empty files)
  • Graphic tutorial on how to share folders in Linux on the host and VMware
  • How to modify the root or other user password when you forget the password in the virtual machine Linux system
  • How to switch from root to ordinary user to execute scripts or commands in Linux shell scripts
  • How to set and modify user password with the passwd command in Linux

<<:  How does JS understand data URLs?

>>:  Analysis of MySQL concurrency issues and solutions

Recommend

Detailed steps to install the NERDTree plugin in Vim on Ubuntu

NERDTree is a file system browser for Vim. With t...

How to create LVM for XFS file system in Ubuntu

Preface lvm (Logical Volume Manager) logical volu...

Specific use of Linux which command

We often want to find a file in Linux, but we don...

About Tomcat combined with Atomikos to implement JTA

Recently, the project switched the environment an...

Analysis of Facebook's Information Architecture

<br />Original: http://uicom.net/blog/?p=762...

Introduction to Linux environment variables and process address space

Table of contents Linux environment variables and...

How to quickly copy large files under Linux

Copy data When copying data remotely, we usually ...

Linux kernel device driver kernel linked list usage notes

/******************** * Application of linked lis...

HTML table markup tutorial (1): Creating a table

<br />This is a series of tutorials provided...

About Zabbix custom monitoring items and triggers

Table of contents 1. Monitoring port Relationship...

Detailed explanation of mysql transaction management operations

This article describes the MySQL transaction mana...

Several ways to encapsulate breadcrumb function components in Vue3

Table of contents Preface 1. Why do we need bread...

Sample code for implementing two-way authentication with Nginx+SSL

First create a directory cd /etc/nginx mkdir ssl ...

MySQL InnoDB transaction lock source code analysis

Table of contents 1. Lock and Latch 2. Repeatable...