Report this

What is the reason for this report?

What are the correct permissions when setting up a server (Ubuntu, LEMP)

Posted on October 22, 2013

I’m new to all this server config, but I’ve got a Ubuntu 12.04 x32 with LEMP up and running by following https://www.digitalocean.com/community/articles/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-12-04

…and virtual hosts.

I’m a bit confused with permissions. I created a user www. But unless I set the permissions on a file to www-data wthin my var/www/domain.com/public folder it the site doesn’t run properly (no caches etc because of failed write permissions). Problem is, every-time I upload anything via FTP the permissions are root on those files.I’m logged in with root so that makes sense. If I log in with www I get permission denied if I try upload anything.

Further, I installed git. But when I run git init I get Permission denied. Unless I run sudo before it.

I kinda get why all this is happening, but could someone explain what permissions I should have on everything to make it all run smoothly?

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.