linux 建立两台机器的信任关系

两台机器建立信任关系,从A机器拷贝东西到B,不需要录入访问密码

1、A机器生成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:
   06:57:a7:28:2c:2e:5c:d0:fc:7b:9a:06:32:c7:d0:26 [email protected]

2、拷贝密匙到B机器相应用户下

    scp .ssh/id_rsa.pub    @:/home//.ssh/authorized_keys

3、从A机器拷贝东西到B机器,不再需要密码

同一台机器上面scp也需要设立信任关系

已经存在的key,直接cat .ssh/id_rsa.pub >>.ssh/authorized_keys ,就搞定啦~~~

你可能感兴趣的:(Linux,linux,file,user,ssh,c)