ssh without no password

本文详细介绍了如何使用SSH密钥对从本地主机登录远程主机,并解决由于权限设置不当导致的登录问题。通过修改远程主机上的文件权限,确保SSH密钥对认证成功。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

or at least you can't give write privileges to any other user except username itself.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值