I have a filesystem on the host that contains symlinks (e.g. /foo/bar -> /baz/bar). I'm able to mount the filesystem over sshfs fine, but the symlink is resolved on the client, e.g. (they're mounted at the same location):

On the client (mounted with sshfs):

client $ ls -l /foo/bar
-rw-rw-r-- 1 user group 1234 May 28 14:03 /foo/bar

And on the server:

server $ ls -l /foo/bar
lrwxrwxrwx 1 user group 73 May 27 19:16 /foo/bar -> /bar/baz

I have tried running sshfs directly, with no -o follow_symlinks arg, but the symlink continues to be presented as a file.

How can I get the symlink to present as a symlink over sshfs?

I have tried to the server via sftp directly, but it lists the file as a symlink (but with no target) - note the leading l at the start of the line:

$ sftp client
Connected to client.
sftp> cd /foo
sftp> ls -l
lrwxrwxrwx    1 user     group       73 May 27 19:16 bar

Could follow_symlinks be in an rc file somewhere on the server?


I found that for my case, I had a number of filesystems at play.

e.g. I had:

/foo/bar -> /bar/baz

but I also had:

/foo -> /qux

and therefore the original symlink was:

/qux/baz -> /bar/baz

And /foo, /bar and /qux were all different filesystems. I had removed -o follow_symlinks from the sshfs mount in /foo but not /qux. Removing that also helped.

| improve this answer | |

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.