scp在Linux主机之间复制不需要密码

时间:2014-07-23 21:14:26   收藏:0   阅读:270

把你的本地主机用户的ssh公匙文件复制到远程主机用户的~/.ssh/ 文件夹中

1.在本地主机的用户可以是(root,cusadmin,以及准备使用scp的user)

运行:

[root@root ~]# 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 root@root

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.这样就可以远程拷贝不输入密码了,反之亦然


评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!