欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

SSH无密码自动登录

程序员文章站 2022-07-05 08:43:18
...


[root@ShadowFiend Gogo_yueyue]# 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:
11:26:44:a9:14:f1:e3:75::0c:6c:91:7a:28:40 root@ShadowFiend
The key's randomart image is:
+--[ RSA 2048]----+
|.E .o**+o....    |
|.   + *=.o .     |
| . o B  .        |
|  . = .  .       |
|   ..  S         |
|                 |
|                 |
|                 |
|                 |
+-----------------+
[root@ShadowFiend Gogo_yueyue]# ssh root@172.29.0.3 "cat >>~/.ssh/authorized_keys" <~/.ssh/id_rsa.pub 
root@172.29.0.3's password: 
[root@ShadowFiend Gogo_yueyue]# ssh root@172.29.0.3
Last login: Sat Mar  3 14:55:19 2012 from 172.29.0.43
[root@fzo-501 ~]# vi ~/.ssh/known_hosts 
[root@fzo-501 ~]# vi ~/.ssh/authorized_keys 
[root@fzo-501 ~]# vi ~/.ssh/authorized_keys 
[root@fzo-501 ~]# exit
logout