How to set up permissions for public_html?

Hi. Sorry if this is a bit of a newby question.

Have followed the howto https://www.linode.com/docs/websites/hosting-a-website

Excellent guide, but it doesn't say how to set up permissions in /var/www/domain.com/public_html so that I can add, and edit the files easily (without needing root permissions).

At the moment, I got the directory public_html belonging to user. Is that the most secure way to set up permissions there, or is there a better way?

Ta.

1 Reply

If you have a look at the apache2-mpm-itk module, you can have your files inside the publichtml directory in your user directory: \home\joeblow\publichtml\webfiles.html

Then you can login via ssh as the name of the user (joeblow, in this example) and edit the files as you wish, as joeblow will be the owner, and apache will have read (and probably write) access as required via apache2-mpm-itk.

You just need to put this in your virtual host configuration file:

 <ifmodule mpm_itk_module="">AssignUserId joeblow joeblow</ifmodule> 

This assumes you are using Debian and Apache. It could be the same on other OS's which Apache as well.

Edit: fixed AssignUserId user names

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct