ssh 生成多个密钥_如何使用多个SSH密钥?

ssh 生成多个密钥

ssh 生成多个密钥

I work on  Ubuntu and want to use multiple ssh keys to connect different serves. I have tried some different method but unluckily they have failed. How can I use multiple ssh keys?

我在Ubuntu上工作,并且想使用多个ssh键来连接不同的服务。 我尝试了一些其他方法,但不幸的是,它们失败了。 如何使用多个ssh键?

多个主机多个键 (Multiple Hosts Multiple Keys)

Ssh config resides in .ssh/config file in user home directory. The magic is here.

ssh配置位于用户主目录中的.ssh / config文件中。 魔术在这里。

Host cen1 cen1.example.com
 HostName cen1.example.com
 IdentityFile ~/.ssh/cen1_rsa 
 User root

Host ubu1 ubu1.example.org
 HostName ubu1.example.org
 IdentityFile ~/.ssh/ubu1_rsa
 User ismail

Hostname cen1.example.com is the hostname of the remote system. While connecting to this system with IdentityFile ~/.ssh/cen1_rsa configuration makes to use cen1_rsa as key.

主机名cen1.example.com是远程系统的主机名。 在使用IdentityFile〜/ .ssh / cen1_rsa配置连接到该系统时,请使用cen1_rsa作为密钥。

多个键相同的主机 (Multiple Keys Same Host)

This is usefull alternative for key usage too. We want to use multiple keys for same host. As we know ssh is tries related keys for hosts in sequence. We can define new keys with Identity configuration like below

这也是密钥使用的有用替代方法。 我们要对同一主机使用多个密钥。 我们知道ssh是按顺序尝试与主机相关的密钥。 我们可以使用身份配置定义新的密钥,如下所示

Host ubu1 ubu1.example.org
 HostName ubu1.example.org
 IdentityFile ~/.ssh/ubu1_rsa
 IdentityFile ~/.ssh/ubu1bak_rsa
 User ismail

Here IdentityFile ~/.ssh/ubu1bak_rsa is added alternate private ssh for host ubu1.

在此处为主机ubu1添加了IdentityFile〜/ .ssh / ubu1bak_rsa。

如何使用多个SSH密钥? 信息移植 (How To Use Multiple SSH Keys? Infografic)

How To Use Multiple SSH Keys? Infografic
How To Use Multiple SSH Keys? Infografic
如何使用多个SSH密钥? 信息移植
LEARN MORE  How To Start, Stop and Get Status of Linux Service With Systemd?
了解更多信息如何使用Systemd启动,停止和获取Linux服务的状态?

翻译自: https://www.poftut.com/use-multiple-ssh-keys/

ssh 生成多个密钥

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值