LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-09-2015, 07:54 PM   #1
RavenLX
Member
 
Registered: Oct 2004
Posts: 98

Rep: Reputation: 15
Question How do I get Apache to run as different users?


(I'm editing my post to hopefully make it clearer).

I am putting together a web server where I have multiple domains. For this example, I'll keep it simple and say we have two domains (though we could have lots more). test1.com and test2.com are the two domains.

I'm setting this up to test on a virtual machine in VirtualBox. So to go to the domains, you'd put in the browser (as an example) in the host: 192.168.1.4/test1.com to get there.

test1.com directory: /var/www/public_html/test1.com (set to 755, test1.com:test1.com owner:group).
test2.com directory: /var/www/public_html/test2.com (set to 755, test2.com:test2.com owner:group).

Script /var/www/public_html/test1.com/testwrite.php will use file_put_contents to write a test file.

Now if say the testwrite.php writes to /var/www/public_html/test1.com/test.txt the file should also be test1.com:test1.com owner:group.

If testwrite.php writes to /var/www/public_html/test2.com/test.txt then it should not be able to do this. It should instead do nothing or, if php is set to report errors to the browser, say that permission is denied to write the file.

I can't get this to work as I state above. I always get permission denied.

I tried installing suexec-custom and setting it up so that in the /etc/sites-enabled/test1.com.conf file it has:

SuexecUserGroup test1.com test1.com

But even after restarting apache2, it still shows permission denied.

Anyone know how to get this to work?

Last edited by RavenLX; 03-09-2015 at 08:59 PM. Reason: Edited to better clarify what I am trying to do.
 
Old 03-11-2015, 08:36 AM   #2
sag47
Senior Member
 
Registered: Sep 2009
Location: Raleigh, NC
Distribution: Ubuntu, PopOS, Raspbian
Posts: 1,899
Blog Entries: 36

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
You have a couple of options. You could use mod_privileges. You could also run separate apache instances within docker containers. I would personally use containers for full separation of services and then proxy pass the containers from the host OS.
 
Old 03-11-2015, 09:18 AM   #3
RavenLX
Member
 
Registered: Oct 2004
Posts: 98

Original Poster
Rep: Reputation: 15
This is a test system. I need something that won't really rely on a host in the end because it's a model for a production system. And the production system will not have a lot of memory or space. Things need to be kept as lightweight as possible.

I like the mod_privileges idea and will look into it.

Thank you for the advice.
 
Old 03-11-2015, 10:28 AM   #4
RavenLX
Member
 
Registered: Oct 2004
Posts: 98

Original Poster
Rep: Reputation: 15
I looked into mod_privileges and it's not in the repos so I can't even use it. I did try mpm-itk but that didn't work. Got the same results.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I call-run mysql commands from apache and show the result in apache Glenn D. Linux - Software 1 04-04-2014 01:56 AM
[SOLVED] how to run scripts for different users sryzdn Linux - Newbie 5 03-22-2014 11:15 AM
Help with Apache: free access from lan users and password access to wan users... how? maginotjr Linux - Server 4 01-01-2011 11:08 AM
Run apache with different users bmorel Linux - Software 2 05-10-2005 09:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration