0

I have a server running apache which has as document root /var/www/html/. Apache runs as apache:apache.

This server is filled with content which is scp'ed programmatically from another server which uses a different user to login via ssh than apache, say user1.

The resulting structure is like this:

drwxr-x--- 2 user1  user1    22 23 jun 16.50 .
drwxrwxr-x 3 apache apache   16 23 jun 16.50 ..           <- this is /var/www/html/
-rwxr-x--- 1 user1  user1  6077 23 jun 16.50 myfile.txt

I have tried to add apache to group user1 and user1 to group apache, but to no avail. Apache refuses to serve myfile.txt.

$ whoami
user1
$ groups
user1 wheel apache

$ whoami
apache
$ groups
apache user1

How can I solve this without changing the user which is used to run apache or login via ssh? I'm looking for a solution which doesn't rely on existing folders, which could be destroyed and recreated by the scp.

EDIT: CentOS7 running Apache 2.4.6

Thanks!

JoeSlav
  • 99
  • 2
  • 12
  • First, CentOS does not run Apache as the user `apache`. How did that setup arise? – Michael Hampton Jun 23 '21 at 15:09
  • Sorry, mistake above, it's Apache 2.4.6. Running Centos7. I didn't create this machine so I don't really know how to answer your question. httpd.conf clearly calls out user/group as apache/apache. – JoeSlav Jun 23 '21 at 15:15
  • Hmm, that's probably OK then. What about the file permissions? I don't see any ACLs set in the directory listing that you posted. Have you tried setting the ACLs to allow the access you want? – Michael Hampton Jun 23 '21 at 15:20
  • No, I don't understand how that will help if the folders are created dynamically, but I'm not good at this so I might be missing the point. – JoeSlav Jun 23 '21 at 15:26

1 Answers1

0

So, adding the user to the group was already the correct solution. All I needed was to restart apache.

JoeSlav
  • 99
  • 2
  • 12