Plesk File Manager: Basic Linux File Permissions
In the File Manager's file listing, a column labeled Permissions has a string of symbols representing who may access the file or the directory's contents. These permissions are divided into three sets of symbols containing r (read), w (write), and x (execute); a dash (-) in place of one of these symbols represents permission not given. Clicking on the permissions symbols in the listing will allow you to change them according to your needs.
User, Group, and Other Permissions
User - The first set of three permission symbols determines what the file owner (the user listed in the User column) can do with it. A user can allow other users on the same system to both read and write to a file. It's also possible for users to deny write access to themselves, such as ensuring that an important document cannot be accidentally deleted.
Group - The next set of permissions represents all users in the file's group (the group listed in the Group column) can do.
Other - The last set of permissions applies to everyone else not otherwise specified.
Numerical Permissions
Sometimes Linux files and permissions are given in sets of three or four digits instead of the rwx
symbols in File Manager, with the three digits corresponding to different combinations of each of the three groups. While numerical permissions are also valid for setting permissions on files; however, the meanings of these numbers are sometimes quite obscure, and only the most common ones are usually important.
In general, the last three numbers of numerical permission represent the user, group, and other permissions, respectively. If there is a fourth column, the first column is for any special permissions. Setting a zero in any of the last 3 numeric columns disables all permissions in the corresponding rwx
symbol set. These are the numeric file and directory permissions you may see most often referred to in documentation:
Numeric* | Symbols | Meaning | Common Usage |
---|---|---|---|
0777 | rwxrwxrwx | Everyone: read, write, and execute | NONE - BIG security risk! |
0755 | rwxr-xr-x | Read, write and execute; everyone else, read and execute | common for scripts and programs |
0700 | rwx------ | Read write and execute; everyone else, no permissions | Private scripts and programs |
0666 | rw-rw-rw- | Everyone: read and write | Shared files |
0644 | rw-r--r-- | Read and write; everyone else, read | Shared files (read-only) |
0600 | rw------- | Read and write; everyone else, no permissions | Private files |
Numeric* | Symbols | Meaning | Contained files are |
---|---|---|---|
0777 | rwxrwxrwx | Everyone: list, create/delete, and traverse | World-writeable - security risk! |
0755 | rwxr-xr-x | List, create/delete, and traverse; everyone else, list and traverse | Public - potential security risk! |
0700 | rwxr------ | List, create/delete, and traverse; everyone else, no permissions | Private |
* The leading zero is usually omitted
Changing File Permissions
Files
On files, the execute
permission is set on scripts and binaries so the server knows it can be run. In general, files should not be executable unless truly necessary; for instance, it's not necessary for the files installed by WordPress to be executable on the server, but scripts in cgi-bin should be.
Directories
For directories, the permissions look the same but have a slightly different meaning. The read
permission means that files can be listed, write
means that files can be created and deleted, and execute
means that it can be traversed - or, put more simply, that you can go into other directories inside it. In general, most directories should be read-write-execute for the owner and read-execute for everyone else; there are some cases where directories have more restrictive permissions for security reasons.
htdocs
as world-writable is an invitation to be hacked, as is a file with sensitive information (such as error logs) in a public directory.If you don't want a file viewable to the public, do not put it under
htdocs
And make sure the webserver cannot write the files it executes.For detailed instructions on how to change file permissions in Plesk, please read the following article: