我可以通过 SSH 连接到远程主机,但使用 SSHFS 获得“对等连接重置”,我错过了什么?

stw*_*sel 8 authentication sshfs

我创建了一个密钥对以从 12.04 连接到 Synology 磁盘。部署完毕,编辑 ~/.ssh/config 自动使用。测试:

ssh user@remotesynology
Run Code Online (Sandbox Code Playgroud)

-> 就像一个魅力。在第二台远程机器上测试(运行 Ubuntu 服务器)-> 工作。

现在测试:

sshfs user@theubuntuserver: /home/user/ubuntuserver
Run Code Online (Sandbox Code Playgroud)

-> 作品

最后:

sshfs user@remotesynology: /home/user/remotesynology
Run Code Online (Sandbox Code Playgroud)

-> 错误:

read: Connection reset by peer
Run Code Online (Sandbox Code Playgroud)

我查看了这个问题,但这似乎并不适用(我在 fuse 组中有用户,并且它适用于另一台机器)并且我没有收到权限被拒绝的错误。

我想念什么?

ear*_*Lon 2

我过去曾遇到过sshfs行为怪异的问题。安装后您真正应该做的第一件事sshfs是重新启动计算机,或者至少X在将自己添加到熔断器组后重新启动计算机。

当用户不在熔断中或者未启用熔断中的allow_other时,通常会出现此错误。

有时我的 ssh 密钥会引起问题。我必须明确告知sshfs要使用哪个密钥文件,即使已ssh对其进行配置 ( ~/.ssh/config)。

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

另一个解决方案是使用您的/etc/fstab并在此处添加新条目:

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
Run Code Online (Sandbox Code Playgroud)

这告诉您的机器安装/remote/path/mnt/local/path. 据说这个挂载将是一个熔断文件系统。还有一些其他设置允许进行诸如在网络可用时安装、在断开连接时自动重新连接等操作。

idmap 和allow_other 部分允许fuse组内的用户挂载文件系统。它还将帮助映射权限以匹配指定的用户和组。

在此示例中,您可以运行以下命令来安装文件系统:

  • mount /mnt/local/path/
  • ls /mnt/local/path/