Re: Symlinks not accessible when mounting with sshfs

Eduardo M KALINOWSKI <[email protected]> Mon, 27 Jul 2026 11:12:51 -0300
Newsgroups gmane.linux.debian.user
Message-ID <[email protected]>
On 27/07/2026 10:44, Franco Martelli wrote:
> Hi,
> 
> I've the following issue with sshfs while it doesn't happen when I login 
> using ssh:
> 
> root@itek:~# sshfs rpi:/ /media/raspberrypi
> 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/
> root@itek:~# ssh rpi
> 
> [...]
> 
> root@raspberrypi:~# LC_ALL=C.UTF-8 ls -l -a -h /etc/alternatives/rsh
> lrwxrwxrwx 1 root root 12 Nov 27  2019 /etc/alternatives/rsh -> /usr/ 
> bin/ssh
> 
> I pick "/etc/alternatives/rsh" as case test but many symlinks cannot be 
> read when mounting the filesystem via sshfs. I don't want to use the 
> option "follow_symlinks":
> 
> 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/
> 
> because sshfs replace the symlink with the pointed file, I just want the 
> symlink be readable. Does anybody know how to accomplish that?
> 
> Thank you very much for any hint, kind regards.

I had to add -o no_contain_symlinks to a sshfs mount recently (even if 
the symlink containing .. pointed to a file inside the shared 
directory). Note that this option might allow access to files outside 
the shared directory.