• 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 ?


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.

| improve this answer | |
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.