1

We're running on Ubuntu and have an Apache2 webserver with some apps that require cron-jobs installed.

The cron jobs occasionally send mails which of course goes to the www-data user. The home dir of that user is /var/www but for security reasons that directory is owned by root (maybe this is a bad idea...) which makes it difficult to use www-datas account.

I'm considering changing www-datas home directory to /home/www-data to make things easier.

Would changing the home directory of the Apache default user break anything?

4
  • Consider the alternative: Use an email alias to forward mail for www-data to another user.
    – Tonny
    Aug 23, 2013 at 13:06
  • I have considered that, and I might still go that route, but there are also other things besides mail, like all the .-files for settings etc.
    – thoni56
    Aug 23, 2013 at 13:12
  • Did any of these answers solve your question, or did you find a solution yourself? Feb 15, 2014 at 4:38
  • Well, I got no definite answer before trying it out myself. And it didn't break anything ;-) So I have accepted the simplest answer that says so.
    – thoni56
    Feb 17, 2014 at 10:07

2 Answers 2

2

Changing the home dir for that user wont break Apache. Apache will have a root www path set so make sure you dont delete or change permissions for that folder (or folders for multiple sites).

1

No it wouldn't. I have set up several VHOST's where the document root directories are in my HOME directory. The tree structure is similar to this

HOME

PUBLIC_HTML

Domain1
Public
Private
log
cgi-bin
backup
Domain2
Public
Private
log
cgi-bin
backup

Since you have an existing site ensure that you change the vhost configuration files to point to the appropriate document root's, change the logs to write to the log directory under the respective domain directory that you have just created instead of var/log. I usually create a separate .conf file for each vhost rather than having a single lengthy default conf file. It gives me a great deal of flexibility to manage my sites.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .