I want to sshfs from my Linux machine (Ubuntu 18.04.2 LTS) to my MacBook. I could do it at command line with
sshfs email@example.com:/Users/jczhang/mysharedfolder /home/jczhang/mysharedfolder
It worked perfectly. Since I wanted to mount the shared folder automatically at boot time, I put this in /etc/fstab.
firstname.lastname@example.org:/Users/jczhang/mysharedfolder /home/jczhang/mysharedfolder fuse.sshfs delay_connect,_netdev,user,uid=1000,gid=1000,IdentityFile=/home/jczhang/.ssh/id_rsa,allow_other 0 0
Here, 1000 is my uid and gid in Linux. After reboot, I found the directory was mounted but I could not access the directory.
ls -l d????????? ? ? ? ? ? mysharedfolder/ cd mysharedfolder -bash: cd: mysharedfolder: Input/output error mount status had email@example.com:/Users/jczhang/mysharedfolder on /home/jczhang/mysharedfolder type fuse.sshfs (rw,nosuid,nodev,noexec,relatime,user_id=0,group_id=0,allow_other,_netdev,user)
I did not know why sshfs kept using user_id=0,group_id=0. I tried different combinations of uid=1000,gid=1000 and idmap=user. None worked. I umounted the shared folder and did "mount -a". It still did not solve the problem.
I used the default SSHFS version 2.10. Later, I upgraded it to version 3.5.2. Nothing changed.
Does anyone know a solution? Thanks.
This problem drove me mad. Since this shared folder is for my personal use and sshfs works at command line, I find a workaround. In .bashrc, I put
if ! [ -d /home/jczhang/mysharedfolder/flagfile ]; then
sshfs firstname.lastname@example.org:/Users/jczhang/mysharedfolder /home/jczhang/mysharedfolder -o idmap=user,uid=1000,gid=1000
flagfile is a file to tell whether the folder is already mounted.
Every (first) time I login to Linux, the folder is automatically mounted for me.
It works great!