If you want to login remote host B from local host A in background without password:
use
1) ssh-keygen -t rsa in local host A
2) cat $HOME/.ssh/id_rsa.pub | ssh username@B 'cat >> .ssh/authorized_keys && echo "Key uploaded successfully."'
if you have issue like below by: ssh -vvv B
...
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
usename@B's password:
...
The solution to this issue:
I have found a solution. There was an issue in permissions.
/home/usernameon
remote machine was granted all permissions, but for key based auth it can be set to 755
本文详细介绍了如何使用SSH密钥对从本地主机登录远程主机,并解决由于权限设置不当导致的登录问题。通过修改远程主机上的文件权限,确保SSH密钥对认证成功。
9548

被折叠的 条评论
为什么被折叠?



