-
win+R输入cmd,回车,输入
C:\Users\Administrator> ssh-keygen -t rsa -b 4096
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\Administrator/.ssh/id_rsa):
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:2Eb9hOSjGuN+DFd326LpONB0UQtRCvZtrAi1i0UfkM0 administrator@HanYouyang
The key's randomart image is:
+---[RSA 4096]----+
| B=++o |
| B.E . |
| o B =.= |
| + =o*oo. |
| + S+ooo. o |
| ..=o . o .|
| o+ . o . |
| . o ..o |
| .. .o. |
+----[SHA256]-----+
2.到生成的文件目录下
C:\Users\Administrator>cd C:\Users\Administrator\.ssh
3,在远程linux服务器上新建文件夹,在文件下新建.ssh文件夹
我在root文件夹下新建了.ssh文件夹
[root@localhost ~]#mkdir .ssh
4.在cmd命令行输入,linux服务器.ssh文件夹下增加id_rsa.pub文件
C:\Users\Administrator\.ssh>scp id_rsa.pub root@192.168.145.101:.ssh/
root@192.168.145.101's password:
id_rsa.pub
5.linux服务器输入
[root@localhost .ssh]#cat id_rsa.pub >> authorized_keys
6.vscode重新连接,不需要输入密码
推荐一个零声学院项目课,个人觉得老师讲得不错,分享给大家:
零声白金学习卡(含基础架构/高性能存储/golang云原生/音视频/Linux内核)
https://xxetb.xet.tech/s/3Zqhgt