在两台机器上面建立信任关系
[oracle@btasetl .ssh]$ ssh-keygen -t rsa ----A机器上的操作
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:
12:7b:c8:18:77:96:6e:e3:f3:e5:d2:d0:91:df:7c:0d
一直回车下去
执行完成后会在/home/oracle/.ssh 目录下面生成两个文件 id_rsa,id_rsa.pub
把 id_rsa.pub文件传输到B机器上面,并修改名称 authorized_keys
[oracle@btasetl .ssh]$ scp id_rsa.pub mstr@IPB:/home/oracle/.ssh/authorized_keys。
再次使用SCP命令由A机器传输到 B机器上面的时候就不会输入密码。
[oracle@btasetl dlm]$ scp hello mstr@IPB:/home/mstr/dlm
hello 100% 0 0.0KB/s 00:00
[oracle@btasetl .ssh]$ ssh-keygen -t rsa ----A机器上的操作
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:
12:7b:c8:18:77:96:6e:e3:f3:e5:d2:d0:91:df:7c:0d
一直回车下去
执行完成后会在/home/oracle/.ssh 目录下面生成两个文件 id_rsa,id_rsa.pub
把 id_rsa.pub文件传输到B机器上面,并修改名称 authorized_keys
[oracle@btasetl .ssh]$ scp id_rsa.pub mstr@IPB:/home/oracle/.ssh/authorized_keys。
再次使用SCP命令由A机器传输到 B机器上面的时候就不会输入密码。
[oracle@btasetl dlm]$ scp hello mstr@IPB:/home/mstr/dlm
hello 100% 0 0.0KB/s 00:00