This article explains the permissions on a Linux system that regulate access for different types of users to files and directories. There are three user types: owner, group, and others. Permissions are given in the order owner, group, and others, and include read (r), write (w), and execute (x). Typical permissions are 644 for generally readable files and 600 for sensitive files such as configuration files. The article also describes how to change permissions using Plesk, SSH, and FTP (Filezilla), including recursive changes for directories.
Permissions on a Linux system reflect the access rights of different types of users.
The user types are:
- Owner - file owner - on our web hosting servers these are the various domain users (equivalent to your Plesk login / FTP user) or root (server administrator)
- Group - group to which the file belongs - on our web hosting servers this is usually psaserv for server-side files and psacln for files delivered to clients (web browsers) or root
- Others
Permissions for a file are always written in this order: first the owner’s permissions, then the group’s, then others’.
The different permissions are explained below. The permissions are explained including name, abbreviation letter, and numeric value:
- read - r - 4 - Read - files can be read, for directories the contents can be listed
- write - w - 2 - Write - files can be edited or deleted; a w for directories means you can create or delete files within that directory
- execute - x - 1 - Execute - file can be executed if it contains programs; for directories it means that the files inside can be read/edited according to their permissions
The most common permissions are as follows:
- -rw-r--r-- or 644 - the file can be read by everyone and edited and/or deleted by the owner. This is the standard permission for almost all web hosting files.
- -rw------- or 600 - the file can only be read, edited, or deleted by the owner. This is the recommended permission for files containing passwords, such as wp-config.php for WordPress websites and configuration.php for Joomla.
- ---------- or 000 - the file cannot be read, edited, or deleted by anyone; the file is locked. This is typically seen after malware reports. However, permissions can be adjusted by the owner.
drwxr-xr-x or 755 - the d at the start of the line stands for directory. The owner has full access, the group and others can view the contents of the directory according to the permissions of the contained files. This is the standard permission for directories in web hosting. - d--------- or 000 - the directory is locked; permissions can also be adjusted by the owner.
Plesk File Manager
SSH
FTP (Filezilla)
Plesk File Manager
- Log in to the Plesk administration tool. (Forgot your password?)
- Make sure you are on the Websites & Domains tab and select File Manager there.
- Click the button at the end of the row for the file or directory whose permissions you want to adjust. Then click Change Permissions.
-
You will then see the set permissions and can adjust them using checkboxes. Complete the process by clicking OK. Below you can see the mentioned standard file permission 644.
SSH
If you want to adjust permissions using SSH / command line, make sure that SSH access is enabled and you are logged in.
Navigate to the directory where the file whose permissions you want to adjust is located:
musterhans@servername /> cd httpdocs
List the files to view their permissions:
musterhans@servername /httpdocs> ls -la
total 128
drwxr-x--- 5 musterhans psaserv 72 Oct 22 13:00 .
drwx--x--- 12 musterhans psaserv 4096 Dec 8 15:24 ..
drwxr-xr-x 2 musterhans psacln 22 Oct 22 13:00 css
-rw-r--r-- 1 musterhans psacln 113459 Oct 22 13:00 favicon.ico
drwxr-xr-x 2 musterhans psacln 4096 Oct 22 13:00 img
---------- 1 musterhans psacln 5642 Oct 22 13:00 index.html
drwxr-xr-x 7 musterhans psacln 61 Oct 22 13:00 test
In this example, index.html is locked. Permissions can now be adjusted as follows:
musterhans@servername /httpdocs> chmod 644 index.html
For a directory, SSH also allows you to adjust permissions recursively, i.e., assign the same permissions to the directory and everything inside it. This is done with a -R after chmod.
FTP (Filezilla)
- Make sure the FTP program is set up correctly: https://support.metanet.ch/45
- After logging in, right-click the file or directory you want to change, at the bottom select File Permissions…, please click it.
- Now you can adjust the permissions using checkboxes or the numeric value and save with OK.