0

I recently migrated from a Centos Cpanel server setup to Ubuntu and have been trying to work out how to setup multiple users that are restricted/jailed to their own home directories when they ssh to the server as was the case in Cpanel.

I have a server that hosts multiple websites (mostly PHP based sites) and want to provide website owners access only to their website directories.

The server setup is as follows...

Ubuntu 16.04 Apache 2.4 PHP 7.0 - php-fpm MYSQL Varnish

I've done some digging to see how this could be done and have come up with the following method...

  1. Create seperate users and usergroups for each website owner.
  2. Use Apache vhosts to set userdir of the web directory to the user's home folder i.e. /home/user/public_html
  3. Chown all files and folders within the web dir to the user:usergroup created in step 1.
  4. Configure a seperate php-fpm pool for each website owner ensuring php runs as their own user.
  5. Chroot users ssh to their own home directory using method and make_chroot_jail.sh script explained here (https://www.howtoforge.com/restricting-users-to-sftp-plus-setting-up-chrooted-ssh-sftp-debian-squeeze/#-enabling-chrooted-ssh) and here (http://www.fuschlberger.net/programs/ssh-scp-sftp-chroot-jail/)

Given I already have a bunch of websites running on this server and would require a fair bit of work to get the above going, I guess I was hoping that somebody a lot smarter than myself could let me know if the above method is sound and worth going ahead with?

Peter A
  • 101
  • The cPanel license is a lot cheaper than your time. – Michael Hampton Dec 06 '17 at 23:35
  • We are not using cPanel for a reason and cost is not the issue. I specifically mention that we are moving away from cPanel. Your comment is not helpful at all. – Peter A Dec 07 '17 at 00:24
  • Yes, although if you are looking at howtoforge you may want to check out ISPConfig - been a long time since I've used it but I think it supports auto chrooting with control over what binaries users can run – ivanivan Dec 07 '17 at 01:04

0 Answers0