解释:read PEM private key done: type <unknown>

SSH不需要登陆密码来实现多台服务的交互,发现了这个错误:
ssh -v localhost
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to localhost [::1] port 22.
debug1: Connection established.
debug1: identity file /home/app/.ssh/identity type -1
debug1: identity file /home/app/.ssh/identity-cert type -1
debug1: identity file /home/app/.ssh/id_rsa type 1
debug1: identity file /home/app/.ssh/id_rsa-cert type -1
debug1: identity file /home/app/.ssh/id_dsa type -1
debug1: identity file /home/app/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
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 'localhost' is known and matches the RSA host key.
debug1: Found key in /home/app/.ssh/known_hosts:1
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,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Trying private key: /home/app/.ssh/identity
debug1: Offering public key: /home/app/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Enter passphrase for key '/home/app/.ssh/id_rsa':


错误的根源是误解了公钥/私钥的观念:
1. 如何你使用passphrase产生了公钥和私钥,私钥不是空字符串的情况下,交互链接
方始终要求你提供私钥。也就会出现上面的提示输入私钥, 提供了私钥才能交互。
2. 除非你将私钥为空字符串,即empty passphrase.

解决方法:
   [app@hadoop-master ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/app/.ssh/id_rsa): 【press Enter button】
Created directory '/home/app/.ssh'.   
Enter passphrase (empty for no passphrase): 【press Enter button】
Enter same passphrase again: 【press Enter button】
Your identification has been saved in /home/app/.ssh/id_rsa.
Your public key has been saved in /home/app/.ssh/id_rsa.pub.
The key fingerprint is:
2e:f7:e7:2d:10:63:60:63:12:16:c0:7f:ee:f3:55:63 app@hadoop-master
The key's randomart image is:
+--[ RSA 2048]----+
| ...+o |
| ... = |
| . + o |
| . . + |
| oS. o E |
| .. . o . |
| ..o .. |
| oo. .o. |
| ooo... |
+-----------------+







评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值