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 explanation of COLLATION examples in MySQL that you may have overlooked

Preface The string types of MySQL database are CH...

Detailed explanation of the practical use of HTML table layout

When is the table used? Nowadays, tables are gene...

A time-consuming troubleshooting process record of a docker error

Table of contents origin Environmental Informatio...

Solution to the problem of MySQL deleting and inserting data very slowly

When a company developer executes an insert state...

How to use Baidu Map API in vue project

Table of contents 1. Register an account on Baidu...

The role of MySQL 8's new feature window functions

New features in MySQL 8.0 include: Full out-of-th...

Set an icon for the website to be displayed on the far left of the browser tab

What is the purpose of this sentence? Copy code Th...

uniapp implements date and time picker

This article example shares the specific code of ...

Put frameset in body through iframe

Because frameset and body are on the same level, y...

How to configure the My.ini file when installing MySQL5.6.17 database

I recently used the MySql database when developin...

HTML realizes real-time monitoring function of Hikvision camera

Recently the company has arranged to do some CCFA...

Native js to achieve simple carousel effect

This article shares the specific code of js to ac...

MySQL 5.7.17 winx64 installation and configuration tutorial

Today I installed the MySQL database on my comput...

Complete the search function in the html page

Recently I've been working on a framework tha...

Detailed explanation of MySql data type tutorial examples

Table of contents 1. Brief Overview 2. Detailed e...