码迷,mamicode.com
首页 > 系统相关 > 详细

Linux上SSH登录远程服务器免密码

时间:2017-12-04 23:42:15      阅读:251      评论:0      收藏:0      [点我收藏+]

标签:erp   gen   远程   main   ip地址   image   执行   inux   ica   

  在本地的客户端SSH到远程服务端时,每次都要输入用户名和密码,如果不想每次都输入密码则可以使用以下操作。

  首先在本地的客户端输入 ssh-keygen

[keysystem@localhost ~]$ ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/home/keysystem/.ssh/id_rsa): 
Created directory /home/keysystem/.ssh.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/keysystem/.ssh/id_rsa.
Your public key has been saved in /home/keysystem/.ssh/id_rsa.pub.
The key fingerprint is:
af:a4:d5:4d:96:3c:24:71:ea:37:47:0c:51:3b:ba:2b keysystem@localhost.localdomain
The keys randomart image is:
+--[ RSA 2048]----+
|          . +o.  |
|           + o . |
|          o . =  |
|         . + + . |
|        S . X .  |
|         o = =   |
|        o o o    |
|       + .E  .   |
|      . .  ..    |
+-----------------+
[keysystem@localhost ~]$ 

生成公私钥对,可以进入到~/.ssh目录下查看生成的公私钥对。

[keysystem@localhost ~]$ cd ~/.ssh/
[keysystem@localhost .ssh]$ ll -rlt
total 8
-rw-r--r--. 1 keysystem keysystem  413 Dec  4 22:12 id_rsa.pub
-rw-------. 1 keysystem keysystem 1675 Dec  4 22:12 id_rsa
[keysystem@localhost .ssh]$ 

然后执行 ssh-copy-id dzy@172.20.16.42,其中dzy为远程主机的用户名,172.20.16.42为远程服务器的IP地址。

[keysystem@localhost ~]$ ssh-copy-id dzy@172.20.14.42

 

Linux上SSH登录远程服务器免密码

标签:erp   gen   远程   main   ip地址   image   执行   inux   ica   

原文地址:http://www.cnblogs.com/alsodzy/p/7979299.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!