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

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?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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.