Quantcast
Channel: Active questions tagged mount+fstab - Ask Ubuntu
Viewing all articles
Browse latest Browse all 699

sshfs with fstab: wrong uid, gid and Input/output error

$
0
0

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 jczhang@10.0.2.2:/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.

jczhang@10.0.2.2:/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 -ld?????????  ? ?       ?              ?            ? mysharedfolder/cd mysharedfolder-bash: cd: mysharedfolder: Input/output errormount status hadjczhang@10.0.2.2:/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.

UPDATE:

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 putif ! [ -d /home/jczhang/mysharedfolder/flagfile ]; then sshfs jczhang@10.0.2.2:/Users/jczhang/mysharedfolder /home/jczhang/mysharedfolder -o idmap=user,uid=1000,gid=1000fiflagfile 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!


Viewing all articles
Browse latest Browse all 699

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>