0

我正在尝试使用 SSHFS 连接两台服务器。

以 root 身份启动命令时sshfs myuser@ip_adress:/some/dir /other/dir -o idmap=user,identityfile=/home/myuser/.ssh/id_rsa,一切正常。

/etc/fstab但是,当我在运行中设置此 SSHFS 配置时mount -a,它会挂起。中的行/etc/fstab是:

myuser@ip_adress:/some/dir /other/dir  fuse.sshfs defaults,_netdev,IdentityFile=/home/myuser/.ssh/id_rsa 0 0

我已经尝试了很多选择,但到目前为止,没有任何效果。

通过添加选项并运行ssh_command=ssh\040-vv,sshfs_debug,debug,我得到以下输出:/etc/fstabmount -av

executing <ssh> <-vvv> <-x> <-a> <-oClearAllForwardings=yes> <-oidentityfile=/home/myuser/.ssh/id_rsa> <-2> <myuser@ip_adress> <-s> <sftp>
OpenSSH_8.4p1 Debian-5, OpenSSL 1.1.1k  25 Mar 2021
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolve_canonicalize: hostname ip_address is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/root/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/root/.ssh/known_hosts2'
debug2: ssh_connect_direct
debug1: Connecting to ip_address [ip_address] port 22.
debug1: Connection established.

我不明白为什么 SSH 连接此时挂起。

你知道是什么问题吗?

谢谢

4

1 回答 1

0

所以我发现了问题:我试图挂载.ssh文件夹(它有连接到远程服务器的密钥)。

我不知道为什么它在命令行上工作,而不是通过 fstab(可能是 SSH 代理),而是安装用于连接到 SSHFS 的文件夹导致了这个问题。我将 SSH 密钥移动到另一个目录,然后它就像一个魅力。

于 2021-06-10T08:02:29.377 回答