把你的本地主机用户的ssh公匙文件复制到远程主机用户的~/.ssh/ 文件夹中
1.在本地主机的用户可以是(root,cusadmin,以及准备使用scp的user)
运行:
[[email protected] ~]# 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:
16:f4:95:66:a8:4f:b4:b0:db:b2:5a:64:5d:60:9b:27 [email protected]
The key‘s randomart image is:
+--[ RSA 2048]----+
| . o... |
| ..oo=+ |
| .=E+o |
| ooo+ |
| S=. |
| +o o |
| .o |
| .. |
| .. |
+-----------------+
此时会在/root/.ssh 目录生成id_rsa、id_rsa.pub 两个文件
2.把本地主机生成的id_rsa.pub文件拷贝到需要远程主机的 .ssh 目录下,可以是(root,cusadmin,以及准备使用scp的user),并且改名为 authorized_keys
3.这样就可以远程拷贝不输入密码了,反之亦然