0

I have an sshfs mount to my file server. In the mounted directory there is a symlink that points to /tmp/localfile. /tmp/localfile does not exist on the remote server, but does exist on the local machine with which making the mount.

Is there any way for me to mount the remote directory such that symlinks within it refer to paths on my local machine. Currently running ls -l on the mounted directory shows a bunch of question marks next to the symlinks.

6
  • In general that's a bad idea. You might end up breaking links which are meant to point to the remote server's files.
    – muru
    Commented Jul 8, 2019 at 4:04
  • The use case here is so that I can mount some of the directories in my home directory. A more concrete example would be my documents folder is a mounted folder from the server, and it has a node_modules folder somewhere in it that has a symlink to something outside of the documents folder. Commented Jul 8, 2019 at 4:07
  • And you're sure none of the files in the modules would be symlinks to other files there?
    – muru
    Commented Jul 8, 2019 at 4:20
  • All of the symlinks would resolve to files on the local machine, either because the file is on the local machine, or because the file is on the server, but it's been mounted to the local machine under the path the symlink points to. Commented Jul 8, 2019 at 4:21
  • 1
    Then you should remove follow_symlinks from the mount options.
    – muru
    Commented Jul 8, 2019 at 4:24

1 Answer 1

1

SSHFS defaults to resolving symlinks locally, and needs the follow_symlinks option to instead resolve links on the remove system. Removing it from the mount options should be enough.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .