window免密远程连接Linux

1、在Windows终端Powershell上获取本地密钥,一直回车到此画面

ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\Administrator/.ssh/id_rsa):
Created directory 'C:\Users\Administrator/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\Administrator/.ssh/id_rsa.
Your public key has been saved in C:\Users\Administrator/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:jRpxlfLnCHEhy+iBxXrBrCnA9VOHfdGMeUD1lObI4dk administrator@DESKTOP-T4LH55L
The key's randomart image is:
+---[RSA 2048]----+
|. .. +..+.+*O. ..|
|..  .o*++=o+ =oo |
| .  .*+.+=. + B. |
|  . +.o+.o. .= E |
|   . .o S..+     |
|       o  . .    |
|      .          |
|                 |
|                 |
+----[SHA256]-----+

2、将生成的pub写入远端linux指定目录(需要输入一次密码)

scp C:\Users\Administrator/.ssh/id_rsa.pub root@12.7.10.8:/root/.ssh/authorized_keys
The authenticity of host '12.7.10.8 (12.7.10.8)' can't be established.
ECDSA key fingerprint is SHA256:QpdPVkq6NVIHIMOib5IIJ0rm726pfhuReBk8DjyLbO4.
Are you sure you want to continue connecting (yes/no)?
Warning: Permanently added '12.7.10.8' (ECDSA) to the list of known hosts.
root@12.7.10.8's password:
id_rsa.pub                                                                            100%  412     0.4KB/s   00:00

3、测试直接登陆到linux

PS C:\Windows\system32> ssh root@12.7.10.8
Last login: Tue Dec 19 00:44:55 2023 from 6.2.6.1

        Welcome to Huawei Cloud Service

test :: ~ »
  • 10
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值