I am trying to allow my laptop (Ubuntu 13.04) to access my PC (Lubuntu 13.04) hard drive through SSHFS. I'm using RSA keys to connect.
It works perfectly fine if I type this in the terminal:
sshfs my-PC:/a_folder /media/a_folder
But I would like it to be mounted automatically when I boot my laptop. So I added myself to the fuse group:
sudo adduser mynickname fuse
And I added the following line to my fstab file:
sshfs#mynickname@my-PC:/a_folder /media/a_folder fuse defaults,idmap=user,_netdev 0 0
When I boot the laptop, a_folder appears in the list of devices, but is not mounted. When I try to access it through Nautilus, it displays the following error:
mount: only root can mount sshfs#mynickname@my-PC:/a_folder on /media/a_folder
I get the same error if I try
mount /media/a_folder
in a terminal.
If I try
sudo mount /media/a_folder
I get
read: Connection reset by peer
I tried to add "allow_other" as an option in the fstab entry, and uncommented the related line in /etc/fuse.conf, but it didn't change anything.
The user "mynickname" is the owner of the folder /media/a_folder and has rwx permissions.
I looked at many threads on the internet about people with quite similar issues, but nothing worked so far. Usually, people can't even do
sshfs my-PC:/a_folder /media/a_folder
without getting an error, whereas this works fine on my laptop.
Any insight and tips will be greatly appreciated! Thanks.
EDIT: I solved this issue a while ago, but I forgot to update this post. So here is what is in my fstab:
sshfs#mynickname@my-PC:/a_folder /media/a_folder fuse noauto,_netdev,idmap=user,user,default_permissions 0 0
The key option to add was default_permissions if I recall. I had to add mynickname to the group to which belongs /a_folder/ on my-PC.
Best Answer
The problem you are experiencing is that your normal user has a correct setup for your identity file, while the root user has no idea what ssh key to use.
You can fix this by telling fstab what identity file/ssh key to use while trying to connect: