0

I've a permission problem on my dedicated webserver, but I'm not able to understand what I'm doing wrong.

  • Ubuntu 14.04
  • Kernel 3.19.2
  • Apache 2.4.7
  • PHP 5.5.9
  • MySQL 5.5

(all from official repository, except for kernel. It comes from vivid repository)

I've installed apache2 and it starts with user www-data

I've set a virtualhost /home/USER1/public_html (where ownership is USER1:USER1)

so If I install any CMS (like joomla, wordpress or phpbb) I get lots of permission problems and I'm forced to set chmod to 777 (OMG! Against common sense) in order to install one of them.

The "standard" mode for this kind of CMS is, as I understand 755 for directory 644 for files

But if I set these permissions, I cannot do anything with the cms (install anything or update it. Files will be considered unwritable). Same problem with 775

So the problem is that my webserver needs all permission to "OTHER" and not just for USER (or at least for GROUP)

In order to avoid this trouble I've added USER1 to www-data group

usermod -a -G www-data USER1

but files are still unwritable with 775 or 755. The only mode allowed still 777 (OMG it's horrible to write it 2 times in the same post :D )

What is the problem and how can I fix it?

Zanna
  • 70,465

1 Answers1

0

I've solved the problem by myself

usermod -a -G USER1 www-data

chown -R USER1:www-data /home/USER1/public_html

chmod ug+s /home/USER1/public_html

this isn't the "best way" but, better then use www-data as owner and manager of all virtualhosts!!!

  • Line 3: chmod ug+s doesn't look right. I don't think s is an option only r, w, and x.... – WinEunuuchs2Unix Jul 15 '17 at 00:25
  • 1
    @WinEunuuchs2Unix s is an option for user (setuid) and group (setgid). Setgid is alright but the setuid bit is the most dangerous permissions setting of all as it allows anyone with permission to execute the file to do so with the EUID of the owner. This seems not to matter much here assuming USER1 is not root, but I'm fairly sure it's not the correct setting. – Zanna Jul 15 '17 at 05:25
  • @Zanna Thank you for the s definition. I'll have to find better google links the next time I read up on chmod. – WinEunuuchs2Unix Jul 15 '17 at 15:21