Proper permissions on WordPress website

So you have a WordPress website and want to set proper permissions on files and folder. Read on how to do that.

I assume you have installed WordPress on a Ubuntu 20.04 LTS server with Apache. This article is not about shared hosting. Focus is on a self hosted instance of WordPress.

Once you install Apache on Ubuntu, it will create a user and group www-data which has access over web server for Apache. Your web server path could be different, I use /var/www/html.

1st thing we will do is assign www-data as owner to web server path.

chown -R www-data:www-data /var/www/html

Next we will set proper Linux permissions on files and folders. The recommended ones are 640 for files and 750 for folders. Here -type represent files(f) or folders(d).

Folders

find /var/www/html -type d -exec chmod 750 {} \;

Files

find /var/www/html -type f -exec chmod 640 {} \;

With the above changes you should see something like below. Use ls -la to list them.

permissions-on-files-folders

You can read more about Linux permissions and how to easily understand them here.

Hopefully it was easy to follow and you have successfully set proper permissions on your WordPress website or blog.

Leave a Reply

Your email address will not be published.