SSHFS follow_symlinks

Sometimes you have a need to use a directory soft link over SSHFS. Example: your server has an external harddrive or flashdrive that you’ve plugged in and you want to access it remotely via SSHFS.

You could modify your fstab or use sudo mount, but a more casual option is to put a soft link into the directory where you usually connect with SSHFS that points to that drive, and use the -follow_symlinks option of SSHFS.

SSHFS Example

external HDD automounted to /media/BigHDD to your server with IP address and you use username joe, mapping the remote SSHFS to your laptop at ~/X.

Here’s the one-time setup for that drive:

  1. login to remote (server) PC (locally or via SSH) and type

     ln -s /media/BigHDD ~/BigHDD
  2. make a script on your laptop, consisting of:

     sshfs -o follow_symlinks [email protected]: ~/X

connect via SSHFS to external server HDD

cd ~/X/BigHDD

after running the script from step 2.

To disconnect the SSHFS drive, as usual type on your laptop

fusermount -uz ~/X



Leave a Comment