我创建了 SSH 密钥并使用ssh-copy-id将其传输到我的目标设备,现在我可以ssh targetUsername@targetHost -p 8798
不提供 RSA 密钥或targetUsername@targetHost的密码但是当我尝试在fstab中挂载 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
即使我提供了一个好的密码,也会要求并拒绝targetUsername@targetHost的密码。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
用于密钥存储,但这并没有改变任何事情。
通过检查
journalctl -u ssh.service
目标机器,我意识到目标主机sshfs#targetUsername
从 fstab 条目中识别为用户名,而我的意图是登录targetUsername。sshfs#
从 fstab 条目中删除解决了该问题。