0
  • I have two servers FTPa and FTPb
  • Each server is running PHP web file transfer app that sits in /var/www/html/files/
  • On both servers some of the app subfolders are mounted with folders inside /sftp/ E.g. mount --bind /var/www/html/files/data/client1/ /sftp/client1/

The purpose of the FTPb is to be the exact replica of FTPa (failover site, essentially). I used sshfs on FTPa to mount remote directory /var/www/html/files/ of FTPb. As soon as I do that the local mounting between /var/www/html/files/data/client1 and /sftp/client1/ gets disabled.

Is there a way to keep /var/www/html/files/data/client1 mounted to /sftp/client1 and at the same time have /var/www/html/files/ mounted to remote /var/www/html/files ?

fermerius
  • 103
  • 2

1 Answers1

0

This could work when you first mount the /var/www/html/files to remote directory and then use do the bind mount. However, I haven't tried such a scenario myself so it might not work.

Instead of using bind mounts here, I would change the application so that it uses /sftp/client1 directly for that location. Without knowing further details of your application, I can't give precise instructions. However, I think that you need to adjust your webserver configuration and application code.

Then, I would use lsyncd to keep the contents of the servers in sync instead of sshfs.

Tero Kilkanen
  • 36,796
  • 3
  • 41
  • 63
  • thanks. how about making sftp users chroot straight into '/var/www/html/files/data/client1/'? Is that a good architechtural approach? – fermerius Jun 29 '16 at 18:22
  • chroot jails are good if you want to restict access to single locations on your server. I think it would be useful in your use case. – Tero Kilkanen Jun 29 '16 at 19:24