最近配了个备份,备份在服务器A上,需要将备份的数据通过scp传输到服务器B上进行保留,所以涉及到配置A到B的信任关系。
1. 在A服务器上
[oracle@A yebiao]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_rsa.
Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
f2:0f:64:1c:0d:20:db:9b:9d:45:0a:23:b9:97:f3:83 oracle@A 服务器
The key's randomart image is:
+--[ RSA 2048]----+
| o.+.. . |
| .= o = |
| ....o o |
| . += + |
| .++S |
| E=o |
| o. |
| o |
| . |
+-----------------+
2. 将生成的id_rsa.pub文件拷贝到B服务器的.ssh目录下。
scp /home/oracle/.ssh/id_rsa.pub 10.18.1.119:/home/backup/.ssh/a.pub
3. 将a.pub的内容加入到authorized_keys文件里。
cat a.pub >> authorized_keys
1. 在A服务器上
[oracle@A yebiao]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_rsa.
Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
f2:0f:64:1c:0d:20:db:9b:9d:45:0a:23:b9:97:f3:83 oracle@A 服务器
The key's randomart image is:
+--[ RSA 2048]----+
| o.+.. . |
| .= o = |
| ....o o |
| . += + |
| .++S |
| E=o |
| o. |
| o |
| . |
+-----------------+
2. 将生成的id_rsa.pub文件拷贝到B服务器的.ssh目录下。
scp /home/oracle/.ssh/id_rsa.pub 10.18.1.119:/home/backup/.ssh/a.pub
3. 将a.pub的内容加入到authorized_keys文件里。
cat a.pub >> authorized_keys
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21374452/viewspace-2130760/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/21374452/viewspace-2130760/