How To Set Access Rights

Table of contents:

How To Set Access Rights
How To Set Access Rights

Video: How To Set Access Rights

Video: How To Set Access Rights
Video: How To Set Access Rights For Newly Created Models In Odoo14 2024, December
Anonim

Directories and files have a set of attributes, based on which the web server software determines what exactly is allowed to do with this file or folder for each specific user or group of users. This set of attributes is referred to as "access rights". Below is a description of how to create and set the desired value of access rights to files and folders.

Chmod: how to set permissions
Chmod: how to set permissions

Instructions

Step 1

Most web servers currently run on UNIX systems, in which all users are divided into three groups: "user" (this is the owner of the folder or file), "group" (this is a member of the same group with the owner of the file), and "world" (these are all other users). Each time the file is accessed, the server determines whether the requestor belongs to one of these groups. For example, if you log into your site using FTP by entering your password and username, then the server assigns you to the "user" group. If besides you there are other users logging in via FTP, they will be assigned to the "group" group. And when a site visitor's browser sends a request for a file, that user will be assigned to the "world" group. Each user classified in this way receives a set of rights - to write, read or execute the file. For example, for a site visitor's request to read from a directory and run a script, the script must have read and execute attributes for the "world" group. And in order for you, as the owner, to be able to create a new directory or file in any existing directory using the FTP protocol, this directory must have a permissive attribute for writing to the "user" group.

Step 2

Now about how sets of user rights are encoded. Each such set consists of three numbers: the first sets the rights for the "user" group, the second for the "group" group, and the third for the "world" group. Each number is a combination of numeric opcodes: 4 - means the right to read (read)

2 - the right to write (write)

1 - execute right For example, to set one of the groups the right to write and execute a file, you just need to add the corresponding numbers (2 + 1 = 3). The right to read and write, respectively, will be obtained by adding 4 + 2 = 6. There are seven options in total: 1 = execute

2 = write

3 = write + execute

4 = read

5 = read + execute

6 = read + write

7 = read + write + execute Thus, in order, for example, to set the most complete rights to a file for each of the three groups, you need to set it a set of attributes, which is expressed by the number 777.

Step 3

Now about the practical establishment of user rights using the FTP client. The UNIX command "CHMOD" (short for CHange MODe) is used to set access attributes. All modern FTP clients send such a command automatically - there is no need to enter it manually, it is enough to enter the corresponding numerical expression of the attributes, or simply put the necessary checkboxes in the corresponding checkboxes. The most important thing for you is to correctly combine the desired attribute values described in the previous step.

Recommended: