1、背景
最近在做项目迁移的过程,需要把数据库备份文件迁移到一台单独的linux服务器中,需要使用ssh两台服务器免登录,所遇到的问题,做一个记录总结!
2、服务器A中生成公钥
[root@localhost .ssh]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): /root/.ssh/id_rsa
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
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:
SHA256:eLxxERqm1GRduIekxtByYNZhLX39uXVoDFM6DwCChTA root@linkmore2
The key's randomart image is:
+---[RSA 3072]----+
| E. +B*O*oo.o. |
| .o+o**o*o+.. |
| .=.+.+++ o.|
| o+ o..++.+|
| ..S .. .. +|
| . + . |
| . |
| |
| |
+----[SHA256]-----+
[root@localhost .ssh]# cd /root/.ssh
[root@localhost .ssh]# ls
id_rsa id_rsa.pub known_hosts