继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

SSH免密登陆:Win登陆linux

大鹏学开发
关注TA
已关注
手记 2
粉丝 0
获赞 0

在本地运行git bash(windows)

ssh-keygen -t rsa -C "xxx@qq.com"

一路回车

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:/k7eBzEwIUHIjhq09GBEkoRMLKKbCV4XzyhHJ3ffsj0 vansenb@foxmail.com
The key's randomart image is:
+---[RSA 3072]----+
|%O   o o+...     |
|O+. .++o oo      |
|=  ..+O.. .o.    |
|o  o.+oo   +o.   |
|o+. +   S   +o   |
|+.     .   ..E   |
|        . .  ..  |
|         + .  .  |
|         .+ ..   |
+----[SHA256]-----+

查看密钥文件

cat ~/.ssh/id_rsa.pub

ssh-rsa 开始,直到个人标识结束,全部复制

登陆到服务器(linux),将公钥写入文件

cd ~/.ssh && vim authorized_keys

使用 vim 编辑器打开文件后按 i 键进入编辑模式,使用键盘快捷键 Ctr V 粘贴刚才复制的公钥字符串。接着按 ESC 键进入 vim 编辑器的命令行模式,输入 :wq 并回车。

免密登陆

ssh root@10.1.1.1

第一次登陆提示

The authenticity of host '10.1.1.1 (10.1.1.1)' can't be established.
ECDSA key fingerprint is SHA256:nGvmS+JKzQf1gG+Nzc0QN/qS6xSp1iV0rJFP1dILel4.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

输入yes即可

Warning: Permanently added '10.1.1.1' (ECDSA) to the list of known hosts.
Last login: Wed Dec 23 21:43:28 2020 from 111.94.33.65

Welcome to Cloud Elastic Compute Service !

Uploading file...

打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP