What are secure ways of sharing a server (ssh+LAMP) with friends?

Posted by Bran the Blessed on Server Fault See other posts from Server Fault or by Bran the Blessed
Published on 2011-01-02T21:24:17Z Indexed on 2011/01/02 21:55 UTC
Read the original article Hit count: 184

What is the best way to share a virtual server with friends? More precisely, I have the following assets:

  • A virtual private server (Debian Lenny) with root access for myself, running...
    • SSH
    • apache2
    • mysql
  • Some unused disk space
  • Some friends in need of hosting

The problem

I would now like to do the following:

  • Hosting one or several domains per friend
  • My friends should have full access to their domains, including running PHP scripts, for example
  • My friends should not be able to poke around in other directories
  • The security of my server should not be compromised by faulty PHP scripts

To clarify: I do trust my friends in the sense that they are not trying to do something evil with their access. I just do not trust the programs they are going to run.

So, what are your recommendations for establishing such a scenario?

Partial solution

I already came up with the following plan:

  • Add chrooted SSH users for my friends
  • Add Apache vhosts per user (point the directories to subdirectories of the homedirectories, i.e. /home/alice/example.com, /home/bob/example.net, etc.

But how can I enforce a chroot-like environment for the scripts they are running within these vhosts? Any pointers would be appreciated.

© Server Fault or respective owner

Related posts about apache2

Related posts about linux-server