Best practice for setting up subdomains with unique user account on Ubuntu Apache

Posted June 5, 2021 188 views

I use a droplet running Ubuntu 20.04 and Apache2 to host a development domain, and for each project I setup a subdomain, pointing to /var/www/subdomains/sub/.

I have a sudo enabled account on the droplet that I can use to rsync a project im working on, but I was thinking it would be better to have a unique user for each project with write permission to ONLY that project folder. So I would never be able to accidently push a project to wrong folder.

Is this good way to manage multiple development projects? Or is there a more common best practice?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi @arrancurran,

What you’ve described is how things should be done! Basically, that’s the best best practice out there due to multiple reasons. The most obvious ones is if one project gets compromised, the others don’t but there are multiple reasons behind why it’s better to do it that way!

Having said that, more often than not this doesn’t happen, and since it’s a development droplet people tend to overlook this setup.

All in all, you can roll with both using one user or using different users. If you want to follow/do how things are supposed to be, then yes create different users for each project. If you think it’s too troublesome for these kind of projects it’s fine not to as well.