您的位置:首页 > 运维架构

SSH服务器之间信任关系!/usr/bin/ssh-copy-id: ERROR: No identities found

2015-08-31 17:06 567 查看

服务器之间SSH相互信任

(新手帖!大神勿喷)

作为运维人员 经常会用到 ssh-copy-id

在使用ssh-copy-id的时候最有可能碰到的一个问题就是ssh报错:

/usr/bin/ssh-copy-id: ERROR: No identities found

 

 

下面将我配置的给大家贴上  然后再说这个报错

1、

[postgres@db1 ~]$ ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/home/postgres/.ssh/id_rsa): 

Enter passphrase (empty for no passphrase): 

Enter same passphrase again: 

Your identification has been saved in /home/postgres/.ssh/id_rsa.

Your public key has been saved in /home/postgres/.ssh/id_rsa.pub.

The key fingerprint is:

42:25:97:b5:cc:1d:88:d8:47:d0:ad:b9:b2:b4:1b:22 postgres@db1

 

备注:敲入这个ssh-keygen -t rsa命令后一路回车就行  不用设置其他   如果设置了连接的时候可能会报错上面这个错误,因为当时我设置了  系统将我的公钥,私钥直接放在了、/home/postgres  下面  而不是/home/postgres/.ssh里面  创建完直接vi /home/postgres/.ssh就能看见你的公钥和私钥了。

2、

接下来就是连接

 

[postgres@db1 ~]$ ssh-copy-id postgres@192.168.128.129

/usr/bin/ssh-copy-id: ERROR: No identities found

这个命令有时候也会报着个错误。

换成

ssh-copy-id -i ~/.ssh/id_rsa.pub postgres@192.168.128.129 即可

 

 

但是!!!键入命令后提示(如果你没有跳出这个提示,请跳过这个步骤直接下一步)

reverse mapping checking getaddrinfo for bogon failed - POSSIBLE BREAK-IN ATTEMPT!

3、

这个时候在你的直接  vi /etc/hosts 在里面添加

[root@db1 ~]# vi /etc/hosts

 

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1               db1 localhost.localdomain localhost

::1             localhost6.localdomain6 localhost6

192.168.128.128 db1

192.168.128.129 db2

~

 

保存退出。

4、

完了之后重新连接即可

[postgres@db1 ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub postgres@192.168.128.129

30

postgres@192.168.128.129's password:   (这个地方要输入要连接的用户的密码)

Now try logging into the machine, with "ssh 'postgres@192.168.128.129'", and check in:

 

  .ssh/authorized_keys

 

to make sure we haven't added extra keys that you weren't expecting.

 

[postgres@db1 ~]$ ssh postgres@192.168.128.129

Last login: Mon Aug 31 22:16:08 2015 from 192.168.128.128

[postgres@db2 ~]$ exit

logout

 

 

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: