linux怎么关闭ssh免密码登录密码,ssh无密码登入设置(完全版)/linux下免输入密码ssh登录...

66b52468c121889b900d4956032f1009.png

8种机械键盘轴体对比

本人程序员,要买一个写代码的键盘,请问红轴和茶轴怎么选?

配置ssh不需要密码登录远程主机,网上有很多文章,但好像完整的不多,笔者参照操作,但得到消息:

Agent admitted failure to sign using the key.

原来是没有启动ssh-agent及把私钥加入到ssh-agent,参考如下文章得以解决问题。下文是完整的配置无密码登录ssh远程主机的方法,推荐参阅。

现有2台机器

1、服务器192.168.1.112

2、个人机192.168.1.110

要使110无需密码通过ssh登入112

步骤

1、创建密钥

[email protected]:~/.ssh$ ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter passphrase (empty for no passphrase): (忽略)

Enter same passphrase again: (忽略)

Your identification has been saved in /home/miao/.ssh/id_rsa.

Your public key has been saved in /home/miao/.ssh/id_rsa.pub.

2、复制公密到服务器

[email protected]:~/.ssh$ scp id_rsa.pub [email protected]:/home/miao/.ssh/192.168.1.110

[email protected] password:

id_rsa.pub 100% 404 0.4KB/s 00:00

[email protected]:~/.ssh$

3、添加公密到192.168.112的信任区域

[email protected]:~/.ssh$ cat 192.168.1.110 >> authorized_keys

[email protected]:~/.ssh$

注: 2,3两步可由命令ssh-copy-id一步到位

[email protected]:~/.ssh$ ssh-copy-id [email protected]

Password:

Now try logging into the machine, with “ssh [email protected], and check in:

.ssh/authorized_keys

to make sure we haven’t added extra keys that you weren’t expecting.

4、启动ssh-agent

如果ssh 192.168.112返回 Agent admitted failure to sign using the key

ps -Af | grep agent查看有无ssh-agent有无运行,若没有

[email protected]:~/.ssh$ ssh-agent

5、添加id_rsa到ssh-agent

[email protected]:~/.ssh$ ssh-add id_rsa

6、完成

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值