/symbol>

How to change folder permissions and owner recursively

When moving your website to the server and navigating through it in the browser, a nasty error may appear – a page with a 403 code will display instead of your website. This means that the DNS service and web server are functioning, but the page is inaccessible. This is mostly due to incorrect permissions set for files and folders. Linux has all default permissions that ensure full access to files and protect them from changes by other system users. These are permissions 644 for files and 755 for folders. You can learn about the meaning of these bits and the separation of access permissions on Linux using public resources on the web. This answer contains a summary of how to set default permissions for your website’s files and folders.

Connect to the server using SSH. Go to the website’s root folder (it may vary depending on the control panel used). This is the folder where you uploaded website files.
Set permission 644 for files using the following command:
find . -type f -exec chmod 644 {} \;

Permission 755 for folders can be set by analogy:
find . -type d -exec chmod 775 {} \;

Use the below command to change the owner and the group of owners for files and folders:
chown -R new_owner_name:new_group_name

Once you set access permissions, the error is supposed to disappear and your website will appear instead.

Related Articles

My disc quota is exceeded. What should I do?

Exceeded disc space quota is a common reason for the improper functioning of services on VPS or...

Protection against DDoS attacks

DDoS is a type of attack when numerous requests are sent to the server. The processing of these...

CPU monitoring

To keep the server up and running, it is important to monitor the processor load and determine...

How to connect to the server via SSH

Despite the numerous server control panels available, the main administration method consists in...

How to create a personal VPN service based on a VPS server

To create a VPN service based on a VPS server, you need the following software: VPS server....