A机与B机的SSH信任关系(直通)

我有A机和B机两个服务器
A为Client: root@nova
B为Server: 192.168.1.16
目的:我在A机登录到B机的时候输入以下命令ssh 192.168.1.16就可以直接登录,怎么实现呢?

[root@nova .ssh]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
2d:e7:49:c7:d0:bc:0e:ae:e5:d9:5e:cc:21:d8:06:5c rootroot@nova
[root@nova .ssh]# ls -ltr
total 44
-rw-r–r– 1 root root 30106 Aug 7 15:45 known_hosts
drwxr-xr-x 2 root root 4096 Sep 2 16:09 tmp
-rw-r–r– 1 root root 236 Sep 2 16:09 id_rsa.pub
-rw——- 1 root root 887 Sep 2 16:09 id_rsa
[root@nova .ssh]#
[root@nova .ssh]# cat id_rsa.pub >authorized_keys
[root@nova .ssh]#
[root@nova .ssh]# scp authorized_keys [email protected]:/root/.ssh/
[email protected]’s password:
authorized_keys 100% 236 0.2KB/s 00:00
[root@nova .ssh]# scp authorized_keys [email protected]:/root/.ssh/

[root@nova .ssh]# ssh 192.168.1.16
Last login: Wed Sep 2 16:03:51 2009 from 192.168.1.10

[[email protected] ~]#
OK …..do any ~

你可能感兴趣的:(ssh)