Re: Symlinks not accessible when mounting with sshfs

Franco Martelli <[email protected]> Mon, 27 Jul 2026 21:37:32 +0200
Newsgroups gmane.linux.debian.user
Message-ID <[email protected]>
On 27/07/26 at 16:03, Andy Smith wrote:
> Without the option "follow_symlinks" isn't it the case that sshfs can't
> follow symlinks at all?

nope, with "follow_symlinks" the symlink is replaced by the file pointed 
by the symlink:

root@itek:~# sshfs -o follow_symlinks rpi:/ /media/raspberrypi
root@itek:~# LC_ALL=C.UTF-8 ls -l -a -h 
/media/raspberrypi/etc/alternatives/rsh
-rwxr-xr-x 1 root root 771K Apr 16 18:19 
/media/raspberrypi/etc/alternatives/rsh
root@itek:~# /bin/fusermount -u /media/raspberrypi/

I don't want that.

> Also note that without the option "transform_symlinks", symlinks to
> absolute paths (such as all the ones in/etc/alternatives/) will be
> pointing to paths on your source system, not the  paths they would
> ordinarily point to on the remote system.

With "transform_symlinks" in addiction I got a warning, but the same 
error message, sadly it doesn't work:

root@itek:~# sshfs -o transform_symlinks rpi:/ /media/raspberrypi
warning: transform_symlinks with contain_symlinks may reject transformed 
links containing '..' - consider adding -o no_contain_symlinks
root@itek:~# LC_ALL=C.UTF-8 ls -l -a -h 
/media/raspberrypi/etc/alternatives/rsh
ls: cannot read symbolic link '/media/raspberrypi/etc/alternatives/rsh': 
Operation not permitted
lrwxrwxrwx 1 root root 12 Nov 27  2019 
/media/raspberrypi/etc/alternatives/rsh
root@itek:~# /bin/fusermount -u /media/raspberrypi/

it works with "no_contain_symlinks" see my other email to Eduardo.
I tar.gzipped the symlinks and then extracted "etc/alternatives/rsh" in 
another directory, it seems OK to me, do you suggest other options 
together "no_contain_symlinks" ?

kind regards,