2

我在机器 M1 上有一个与用户 XXX 一起运行的主机。我想用用户 YYY 在机器 M2 上运行一个从机。

我在两台机器之间有一个私钥-公钥,所以我可以这样做:

[XXX@M1]$ ssh YYY@M2

我是连接的。

在 Jenkins 中,我为用户名 M2 创建了凭据,并选择了From the Jenkins master ~/.ssh选项。但是当我尝试连接时它失败了:

[04/18/13 14:58:11] [SSH] Opening SSH connection to M2:22.
ERROR: Failed to authenticate as YYY with credential=c2cdc4dd-cb39-4f15-8329-033933ad5621
java.io.IOException: Publickey authentication failed.

[04/18/13 14:58:11] [SSH] Authentication failed.
hudson.AbortException: Authentication failed.

令人惊讶的是,如果我直接使用选项Enter并从 复制粘贴私钥~/.ssh/id_dsa,那么它可以工作。

我究竟做错了什么?

4

1 回答 1

2

The order of preference is: id_rsa, id_dsa, identity

So it will take ~/.ssh/id_rsa if that is present and only fall back to ~/.ssh/id_dsa if the id_rsa is missing.

Where you have multiple keys and you need to specify explicitly one key, the recommendation is to either specify the path to the file or use copy & paste

于 2013-04-19T11:46:26.547 回答