Score:0

Issue with Apache permissions with scp'ed document root content

ke flag

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!

Michael Hampton avatar
cz flag
First, CentOS does not run Apache as the user `apache`. How did that setup arise?
ke flag
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.
Michael Hampton avatar
cz flag
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?
ke flag
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.
Score:0
ke flag

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

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.