9

I created a key pair to connect to a Synology disk from 12.04. Deployed, edit ~/.ssh/config to automatically use it. Tested:

ssh user@remotesynology

-> works like a charm. Tested on a second remote machine (running Ubuntu server) -> works.

Now tested:

sshfs user@theubuntuserver: /home/user/ubuntuserver

-> works

Finally:

sshfs user@remotesynology: /home/user/remotesynology

-> error:

read: Connection reset by peer

I had a look at this issue, but that doesn't seem to apply (I have the user in the fuse group, and it works for the other machine) and I don't get a permission denied error.

What do I miss?

2
  • Have you looked at (wiki.archlinux.org/index.php/Sshfs)? It has a short list of debugging/resolution items. E.g.,: is sftp enabled in the server's sshd_config. Dec 6, 2015 at 2:09
  • Connection reset by Peer can be triggered by any loss of network connectivity. My favorite error was infact caused by the Router my ISP provided at the time - which limited inactive TCP connections to 60 seconds, and terminated them. Could you try a normal SSH connection and see if the connection resets, or terminal freezes after say 5 minutes of inactivity? There is a work-around with keep-alives I can try and source for you if this is the case.
    – Laice
    Jan 9, 2016 at 18:49

4 Answers 4

3

In my case (I tried to connect to remote synology as well!) the problem was that SFTP was not enabled on server side. The symptoms were the same: I could ssh to server without any problems, but sshfs command failed.

To enable SFTP on Synology server go to Control Panel -> File Services -> FTP tab -> SFTP section.

2

I've had issues in the past where sshfs was acting weird. First thing you really should do after installing sshfs is restart your machine, or at least X, once you've added yourself to the fuse group.

This error is typically seen when a user is not in the fuse group, or if allow_other in fuse is not enabled.

There have been times where my ssh key was causing issues. I've had to explicitly tell sshfs what key file to use, even when ssh was configured for it (~/.ssh/config).

  • sshfs -oIdentityFile=/full/path/to/id_rsa user@machine

Another solution is to use your /etc/fstab and add a new entry here:

sshfs#USER@MACHINE:/remote/path/ /mnt/local/path/      fuse    user,_netdev,auto_cache,reconnect,uid=1000,gid=1000,IdentityFile=/full/path/to/.ssh/id_rsa,idmap=user,allow_other    0       2

This tells your machine to mount /remote/path to /mnt/local/path. It's saying that this mount will be a fuse filesystem. There are a few other settings that allow things such as mounting when networking becomes available, automatically re-connecting if there is a disconnect, etc.

The idmap and allow_other portion allow users within the fuse group to mount the filesystem. It will also help map the permissions to match up to the user and group also specified.

In this example, you could then run the following to get the filesytem mounted:

  • mount /mnt/local/path/
  • ls /mnt/local/path/
1
  • In my case, I have checked all the above points, the user is in the fuse group, allow_other is correct, the permissions of /etc/fuse.conf is correct, I use allow_other and idmap options, but I can not do sshfs while the server allows me to do ssh but not sshfs and the debug mode says 'no matching cipher found: client arcfour server aes128-ctr,aes192-ctr......'
    – Alex
    Sep 19, 2018 at 21:37
1

If you have iptables firewall rules set up on your server, it might've locked you out while you've been tinkering with sshfs - which would also result in Connection reset by peer.

0
0

I just had the same problem. The reason was SFTP subsystem not being enabled on the server (SSHFS is using it). The solution was adding the following line to /etc/ssh/sshd_config on the server:

Subsystem sftp /usr/lib/openssh/sftp-server
2
  • Why is it down-voted? I also had the same error after disabling SFTP, so I don't see a problem in the first half of the question. Is there a problem with recommended fix? Is it not working or does it have security issues? Oct 10, 2019 at 21:32
  • I have Subsystem sftp /usr/lib/ssh/sftp-server -f AUTHPRIV -l INFO after changed to Subsystem sftp /usr/lib/ssh/sftp-server everuthing start works Feb 18, 2020 at 16:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .