putty 中 设置免密登录远程服务器

 

001、在远程服务器终端生成公钥和私钥

复制代码
[root@PC1 ~]# ssh-keygen -t rsa         ## 执行该命令
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):           ## 回车
Created directory '/root/.ssh'.
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:
SHA256:5fobhRvV7FOd53nF3QWGkdA45pdihUdnrE2d2qsv+14 root@PC1
The key's randomart image is:
+---[RSA 2048]----+
|          .*o==oo|
|          = **ooB|
|         o.+.==.O|
|         o+o+o.++|
|        S.+o. o.+|
|         . +   o.|
|        . o   . E|
|         . . o  .|
|          o. .*+ |
+----[SHA256]-----+
复制代码

 

002、修改公钥名称

[root@PC1 ~]# cd ~/.ssh/                           ## 进入该目录
[root@PC1 .ssh]# ls                                ## 列出内容
id_rsa  id_rsa.pub
[root@PC1 .ssh]# cp id_rsa.pub authorized_keys     ## 复制公钥文件
[root@PC1 .ssh]# ls                                ## 列出内容
authorized_keys  id_rsa  id_rsa.pub

 

003、将私钥文件下载到windows中

密钥文件如下,使用filezilla或其他工具下载至win:

 

004、进入putty的安装目录,win10的默认目录为:C:\Program Files\PuTTY

a、双击 puttygen.exe

 

b、执行 1 和  2

 

 

c、 执行1 和 2:

 

d、

 

e、

 

f、

 

 

g、将id_rsa.ppk保存至安全目录, 这里放置在了putty的安装目录, C:\Program Files\PuTTY

 

h、

 

005、配置putty

a、 其中1为登录名和远程服务器的IP

 

b、

 

c、

 

d、 

 

e、

 

f、

 

g、

 

h、

 

006、免密登录成功

 

参考:https://www.jb51.net/article/63403.htm 

 

posted @   小鲨鱼2018  阅读(566)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
历史上的今天:
2022-05-13 R语言中prod()、cumprod()函数
2022-05-13 R语言中range函数
2022-05-13 R语言中滞后差分 diff()函数
2022-05-13 R语言中set.seed函数的作用
2022-05-13 R语言中pmin、pmax函数
点击右上角即可分享
微信分享提示