Changing file and folder permissions in ISPmanager5
To change permissions for a file/folder, go to "File Manager → WWW → to the necessary folder or file"
Select the desired folder or file and click "Attributes"
In the window that opens, set the necessary rights:
- 1.Specify read, write, and execute rights for the owner. Execution rights for a directory means the right to view its contents
- 2.Specify read, write, and execute rights for the group. Execution right for the directory means the right to view its contents
- 3.Specify read, write, and execute rights for anyone who is not the owner and does not belong to the group. Execution right for a directory means the right to view its contents
In the column "Change child items" we can change the owner and access rights for files and/or directories.
Click "Ok"
Changing permissions on files and folders via FTP
Let's consider changing permissions on the example of an FTP client - FileZilla. When you connect to the account, the root directory will open, where with a right-click you will be able to change the access rights.
Connecting to the account via FTP
Right-click on a file or folder and select "File permissions".
In the new window, set the rights
In the case of a directory, you can change permissions recursively by selecting the "Redirect to subdirectories" option.
Saving changes.
Standard access rights:
- "Files-644"
- "Folders-755"
- "Permissions-777" - grants all privileges to user, group and other system users (not secure and not recommended to set).
Changing permissions on files and folders via SSH
Chmod is a utility which allows you to quickly change permissions for certain owners* and groups* for specified categories and files.
Each file and folder (directory) has its own owner and group to which it belongs. This is done to differentiate access rights for read (r, read), write (w, write) and execute (x, execute) for different users: owners (u)*, users in owner group (g), and others (o)**. Example: 750 and rwxr-x- - - (here the owner has full access to the file, the owner group can open and run the file, but cannot modify or delete it, while everyone else is completely denied access to the file).
Chmod syntax
chmod [-Rvf] [Access Rules] [File/Files/File Directory]
The [Access Rules] part can be either numeric or character values.
[File/Files/File directory] - path to file, files or file directory, absolute or relative
Clues -R, -v, -f
- -R Recursive permission change for directory and subdirectories
- -v Details about how permissions are applied or cannot be changed
- -f Do not display an error message for those files and directories for which access rights cannot be changed
Chmod access rules
Access rights are determined by how the user can interact with files and directories, namely r - read, w - write, x - execute.
These permissions must be prescribed for the three user groups:
- File or directory owner
- Users from the owner's group
- Others
Rights definition table:
So, in order to write a rule for owner to give read and write access, others to give read-only rights, we have to give rw-r--r-- rights
Now take a look at the Symbol and Octal columns. It visually shows that what looks like a character rw-r--r-- looks like 644 in octal form. This is the expression we will use as the numeric notation in the command.
Let's gather everything into one record. For example, let's change the access permissions "give read rights to everybody and the owner the right to change the contents" for the file index.php:
chmod -v 644 index.php
How to check Chmod permissions
ls -ld index.php
where index.php is the file or directory you want to check
Example of correct use of Chmod
The default access rules for directories are 755, for files 644. So, in the vast majority of cases, you will only need these permissions
Below is an example of how to recursively set permissions on all files in the directory /var/www/example.com to 0644, and on all directories and subdirectories to 0755
cd /var/www/example.com
find ./ -type f -exec chmod 0644 {} \;
find ./ -type d -exec chmod 0755 {} \;
With the first command you navigate to the right directory, then use find to find the right type: files -f (files) and directories -d (directories) -and run chmod with the right permissions.
If you have any difficulties in configuration or have any additional questions, you can always contact our support service via Ticket system.