我在工作 并且希望使用多个ssh密钥来连接不同的服务。我试过一些不同的方法,但不幸失败了。如何使用多个ssh密钥?
null
多个主机多个密钥
Ssh配置驻留在 .ssh/配置 用户主目录中的文件。魔法就在这里。
Host cen1 cen1.example.com HostName cen1.example.com IdentityFile ~/.ssh/cen1_rsa User rootHost ubu1 ubu1.example.org HostName ubu1.example.org IdentityFile ~/.ssh/ubu1_rsa User ismail
主机名cen1.example.com 是远程系统的主机名。与此系统连接时 标识文件~/.ssh/cen1u rsa 配置使用cen1u rsa作为密钥。
同一主机上有多个密钥
这也是密钥使用的有用替代方法。我们想对同一个主机使用多个密钥。正如我们所知,ssh是按顺序尝试主机的相关密钥的。我们可以用 身份 配置如下
Host ubu1 ubu1.example.org HostName ubu1.example.org IdentityFile ~/.ssh/ubu1_rsa IdentityFile ~/.ssh/ubu1bak_rsa User ismail
在这里 标识文件~/.ssh/ubu1baku rsa 为主机ubu1添加了备用私有ssh。
如何使用多个SSH密钥?信息图

© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END