比较来自世界各地的卖家的域名和 IT 服务价格

向链添加私钥 ssh

我有几个封闭的键,我用来连接到不同的框。 它主要是为了 AWS, 我需要导入密钥以连接到机器 - 为此,我创建了一个单独的键组。 而不是不断这样做:


ssh -i ~/.ssh/aws-key.pem ec2-user@aws.ip

如何最好地添加

aws-key.pem

在我的 "链键 ssh", 因此,默认情况下,她检查了所有请求 SSH 除了现有密钥 "id_dsa"?
已邀请:

二哥

赞同来自:

你有几个选择。

使用
http://en.wikipedia.org/wiki/Ssh-agent
. 刚使用 ssh-add 对于所有封闭的键,让您的代理确定使用哪个密钥。 我通常喜欢使用代理并始终在输入系统时启动它并添加所有密钥。 这一切都简化了。

更改配置 ssh

# .ssh/config

# per host example
Host blah.example.com
User zoredache
IdentityFile ~/.ssh/username_YYYYMMDD_id_rsa

# global example
Host *
User zoredache
IdentityFile ~/.ssh/key1_YYYYMMDD_id_rsa
IdentityFile ~/.ssh/key2_YYYYMMDD_id_rsa
IdentityFile ~/.ssh/keyn_YYYYMMDD_id_rsa

龙天

赞同来自:

使用

IdentityFile



~/.ssh/config

如果您只想要某些主机,请将其转换为

Host

一个指令。

     IdentityFile
Specifies a file from which the user's DSA, ECDSA or DSA authentication identity is read. The default is ~/.ssh/identity for protocol version 1, and ~/.ssh/id_dsa,
~/.ssh/id_ecdsa and ~/.ssh/id_rsa for protocol version 2. Additionally, any identities represented by the authentication agent will be used for authentication. ssh(1) will
try to load certificate information from the filename obtained by appending -cert.pub to the path of a specified IdentityFile.

The file name may use the tilde syntax to refer to a user's home directory or one of the following escape characters: ‘%d’ (local user's home directory), ‘%u’ (local user
name), ‘%l’ (local host name), ‘%h’ (remote host name) or ‘%r’ (remote user name).

It is possible to have multiple identity files specified in configuration files; all these identities will be tried in sequence. Multiple IdentityFile directives will add
to the list of identities tried (this behaviour differs from that of other configuration directives).

要回复问题请先登录注册