从 fstab 挂载 SSHFS 无法进行身份验证

从 fstab 挂载 SSHFS 无法进行身份验证

我创建了 SSH 密钥,并使用ssh-复制-id现在我可以ssh targetUsername@targetHost -p 8798不用提供 RSA 密钥和密码目标用户名@目标主机但是当我尝试挂载 SSHFS 共享时文件系统(结尾是为了调试目的

sshfs#targetUsername@targetHost:/mnt /media/omnia2 fuse.sshfs _netdev,defaults,IdentityFile=/home/localUsername/.ssh/id_rsa,idmap=user,port=8798,ssh_command=ssh\040-vv,sshfs_debug,debug 0 0

密码目标用户名@目标主机被要求,Permission denied, please try again但即使我提供了一个很好的密钥,它还是被拒绝了。令我惊讶的是 RSA 密钥认证是如何被丢弃的:

debug2: pubkey_prepare: done
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /home/localUsername/.ssh/id_rsa
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug2: we did not send a packet, disable method
debug1: Next authentication method: password
sshfs#targetUsername@targetHost's password:

我认为我已经清除了所有本地权限。我的另一个尝试是将其用于/root/.ssh/id_rsa密钥存储,但这并没有改变任何事情。

答案1

通过检查journalctl -u ssh.service目标机器,我意识到目标主机sshfs#targetUsername从 fstab 条目中识别出一个用户名,而我的目的是登录目标用户名sshfs#从 fstab 条目中删除解决了该问题。

相关内容