Status codes · one code403Forbidden

What a 403 Forbidden response means, who is at fault, what a visitor should do and what the server owner should do.

Open the reference on this code
What is happening

The file is there, and the server refuses to serve it

directory index of "/var/www/site/" is forbidden

The server found the resource and refused to serve it. On your own server the number one cause is file permissions: the web server runs as its own user and needs to enter every directory on the path (x) and read the file (r). The number two cause is what this line literally says: there is no index file in the directory and listing it is not allowed.

Code
Who is at faultClient error
Class4xx Client error
01

What to do

If it is someone else's site

A 403 cannot be fixed from the browser: access is closed on the server and reloading changes nothing. It is worth checking the address — a 403 is sometimes returned for an internal path whose link ended up in an email or in search results by mistake.

If it is your server

Check permissions along the whole path, not just on the file: without x on an intermediate directory the server never reaches it. The working set is 755 for directories and 644 for files, owned by whoever the web server runs as. Watch out for chmod -R 755 over the whole tree: that is the classic mistake which makes ordinary files executable — directories get 755 and files 644 separately.

Work out the permissions: 755 and 644 class by class
02

Easily confused with

401Unauthorized

the server does not know who you are: it needs a sign-in, not rights. That is the entire difference.

401
404Not Found

the resource does not exist at all. A 403 on a path that exists is about rights, not the address.

404
451Unavailable For Legal Reasons

access is closed by a legal demand rather than by the server's own decision.

451
03

How to check

namei -l /var/www/site/index.html

permissions along the whole directory chain — it shows exactly where the path breaks

sudo -u www-data cat /var/www/site/index.html

read the file as the web server rather than as yourself

Find another code

The reference holds sixty-four codes searchable by number, name and meaning — plus a breakdown of confusing pairs such as 401 and 403.

Open the reference on this codeAll codes

Updated

«» added to favorites