Synology – mount a directory via sshfs with user/group mapping

I have been experimenting with sshfs with the intent to access a directory on a Synology box and mount it via Terminal. To this end, I am using version of SSHFS as provided by the FUSE for macOS project.
The setup is following:

  • the directory on the Synology box /volume1/justnfs which is to be mounted is owned by user1:users with user id 1026 and group id 100 and contains directories/files owned by this user only.
  • on my laptop, the user (also user1) mounting the directory has user id 501 and group id 20 (group name staff)

Now, if I do

sshfs -o sshfs_debug syno:/justnfs ./storage

the directory gets mounted, nevertheless the user id/group id of all files is not remapped (as expected). To address this, I created two files with the required mapping, namely users.txt with user1:1026 and groups.txt with staff:100. Then the command

sshfs -o sshfs_debug -o idmap=file -o uidfile=users.txt -o gidfile=groups.txt syno:/justnfs ./storage

also mounts the remote directory, however, if I then switch to storage and do ls, the output is completely empty and dmesg shows

osxfuse: fuse_vnop_readdir failed (err=1)

Strangely enough, when I try to cat a file with known path (i.e., access it directly), the command succeeds and displays the content of the file. It’s as if only the listing of directories was for some reason not allowed.

Interestingly, if I supply the uid/gid explicitly as

sshfs -o sshfs_debug -o uid=501 -o gid=20 syno:/justnfs ./storage

then ls works again.

What could be the reason that the last two commands behave differently and/or that it is not possible to list the content of the directory?