Which permissions to give your website’s files and directories, why you should not use 777, and how to run a Perl or Python script.
Contents
On shared hosting, your website’s scripts run as your account. That means you do not need wide permissions — the ordinary ones are enough:
| Directories | 755 |
| Website files | 644 |
Files containing passwords (wp-config.php, .env) | 600 — only your account can read them |
| Scripts that run on their own (CGI) | 755 |
You change permissions in cPanel: File Manager → right-click the file → Change Permissions. In FileZilla, right-click → “File permissions…”. On your own server, use the chmod command: chmod 644 file.
Perl and Python scripts
- Put the script in the
public_html/cgi-bin/directory and set its permissions to 755. - The first line of the script is the path to the program that will run it:
#!/usr/bin/perlor#!/usr/bin/python3. - The script must first output a header, for example
print "Content-Type: text/html\n\n";— otherwise you will get a 500 error. - If the script was written on Windows, convert the line endings or it will not run: Files from Windows: line endings.
Didn’t find the answer? Ask our support team — we’ll help.