Setting Up Access Rights

General Information on Access Rights

Users by access rights are divided into three categories:

  • owner - the owner of the account (other users can also get the owner's rights),
  • the user group that the owner belongs to (by default, it has the same rights as the "others"),
  • the rest - visitors of the resource.

Rights may include:

  • read (r),
  • record (w),
  • execution (x).

User rights can be written in numbers and letters in the following form: 

Digital notation

Letter notation

Rights

0

---

No rights

1

--x

Execution

2

-w-

Recording

3

-wx

Recording and execution

4

r--

Reading

5

r-x

Reading and execution

6

rw-

Reading and writing

7

rwx

Recording, writing and execution

 

The rights are specified in the following sequence:

  • for the owner
  • for the group,
  • for other users.

For example, write 744 (or rwx r-- r--) means that the owner can read, write, and execute (7 / rwx), and everyone else can read only (4 / r--).

Rights are set differently for files and directories:

Rights

For files

For directories

r, reading

View content

View content i.e. objects in directory

w, writing

Changing content

Changing the contents of the directory, i.e. you can add, delete and change objects in the directory

x, execution

Launching a file for execution

Entering to directory

Examples of access rights combinations:

Numbers

Letters

Rights

700

rwx------

The owner can view and change the contents of a directory or file, run a file, or enter a directory. Other users have no access.

744

rwxr--r--

The owner can view and change the contents of a directory or file, run a file, or enter a directory. Other users can only view the contents of the directory or file

 

You can use the ls -l command to view the set rights. Permissions for files are marked with "-", for directory "d":

User-name@server:~/test_home$ ls -l

total 4

drwx------ 2 username customers 4096 Mar 10 12:30 directory-name

-rw-r--r-- 1 username customers    0 Mar 10 12:30 file-name.txt

Setting Up Access Rights

You can configure file and directory permissions in two ways:

  • via SSH connection,
  • via an FTP client.

Via SSH

 

Permissions are set with the chmod command. We recommend using digital notation. Enter zero before the rights.

chmod 0xxx file-name (or directory-name)

For example:

Set 700 rights on file-name.txt:

username@server:~/test_home$ chmod 0700 file-name.txt

Set 777 rights to directory-name directory:

username@server:~/test_home$ chmod 0777 directory-name/

The –R option allows you to assign rights recursively.

To grant 744 rights to all objects and subdirectories in the current directory:

username@server:~/test_home$ chmod -R 0755 *

Via FTP (FileZilla)

  1. Connect to the server.
  2. Select the required file or directory. Right-click on it and select File rights.
  3. Set the required rights.
    It is also possible to apply settings to subdirectories here. 
  4. Save your changes.

If you have any questions, please create a ticket to technical support.