我使用PuTTY从我的MS Windows工作站连接到我的Linux服务器(我使用其中一个PuTTY相关工具在MS Windows上生成了它们,我不记得生成密钥时使用了哪些参数)。 现在我试图从我的Ubuntu GNU / Linux工作站连接到同一台服务器 。 我的〜/ .ssh中已经有了私钥/公钥对:
id_rsa id_rsa.pub
现在,除了已有的私钥/公钥对之外,我还希望添加用于连接到我的Linux服务器的私钥/公钥对。 对于PuTTY,我有两个文件,可以让我成功连接到我的Linux服务器:
emrePrivate.ppk emrePublic.pub
我已将上述文件复制到我的〜/ .ssh目录中。 然后我尝试使用以下命令连接到我的服务器:
$ ssh -v -i /home/emre/.ssh/emrePrivate.ppk [email protected]
但是我看到它试图使用错误的公钥。 这是输出:
OpenSSH_5.3p1 Debian-3ubuntu4, OpenSSL 0.9.8k 25 Mar 2009 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Connecting to yafz.org [109.74.204.147] port 22. debug1: Connection established. debug1: identity file /home/emre/.ssh/emrePrivate.ppk type -1 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-6ubuntu2 debug1: match: OpenSSH_5.1p1 Debian-6ubuntu2 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_5.3p1 Debian-3ubuntu4 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr hmac-md5 none debug1: kex: client->server aes128-ctr hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Host 'yafz.org' is known and matches the RSA host key. debug1: Found key in /home/emre/.ssh/known_hosts:3 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Offering public key: [email protected] debug1: Authentications that can continue: publickey debug1: Offering public key: /home/emre/.ssh/id_rsa debug1: Authentications that can continue: publickey debug1: Trying private key: /home/emre/.ssh/emrePrivate.ppk debug1: PEM_read_PrivateKey failed debug1: read PEM private key done: type <unknown> Enter passphrase for key '/home/emre/.ssh/emrePrivate.ppk': debug1: PEM_read_PrivateKey failed debug1: read PEM private key done: type <unknown> Enter passphrase for key '/home/emre/.ssh/emrePrivate.ppk':
而且你可以看到它不接受我的密码。 我也试图将emrePrivate.ppk复制到id_rsa,然后将emrePublic.pub复制到id_rsa.pub,但是仍然无法连接到我的Linux服务器。
我特别担心这些问题:
debug1: Offering public key: [email protected] debug1: Authentications that can continue: publickey debug1: Offering public key: /home/emre/.ssh/id_rsa
但我无法find我如何解决这个问题。
有任何想法吗?
您的公钥必须位于目标框上的〜/ .ssh / authorized_keys中。 如果你想在这个关键字不止一个,只需将它们复制到目标框中,然后像这样追加它们即可:
cat id_rsa.pub >> ~/.ssh/authorized_keys
另外,请阅读关于腻子钥匙兼容性以及如何转换钥匙的信息。