Xshell远程登录AWS EC2 Linux实例

文章目录

小结

Xshell远程登录AWS EC2 Linux实例碰到些问题,进行解决并记录。

问题

AWS中创建 EC2 Linux实例,生成的非对称密钥对,使用Xshell远程登录碰到一些问题。

解决

首先在Putty中可以使用的ppk密钥文件在Xshell中是使用不了的,需要使用PUTTYGEN.EXE进行导出为Open SSH的密钥,导出密钥后使用Xshell进行登录。这里注意,完程主机是存放的公钥,本地主机存放的是私钥,用来登录远程主机。

碰到的第一个问题:选择公钥后,反复弹出同样的SSH User Authentication界面,这里我碰到的问题是登录的用户名写错了,区别大小写,例如administrator,写成了Administrator,改好后就可以登录了。

碰到的第二个问题是从Linux机器登录失败。

创建了/root/.ssh/id_rsa文件,并的是先前PUTTYGEN.EXE生成的Open SSH的密(私)钥写入,内容类似如下:

shell 复制代码
[root@Master ]# cat /root/.ssh/id_rsa
-----BEGIN RSA PRIVATE KEY-----
xxxxxxxxxxxxxxxxxxxxxxx
yyyyyyyyyyyyyyyyyyyyyy
..........
-----END RSA PRIVATE KEY-----
[root@Master ]# 

进行登录,报以下错:

shell 复制代码
[root@Master ]# ssh -vvv  administrator@1.2.3.4
...
debug1: Trying private key: /root/.ssh/id_rsa
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/root/.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/root/.ssh/id_rsa": bad permissions
debug1: Trying private key: /root/.ssh/id_dsa
debug3: no such identity: /root/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /root/.ssh/id_ecdsa
debug3: no such identity: /root/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /root/.ssh/id_ed25519
debug3: no such identity: /root/.ssh/id_ed25519: No such file or directory
debug1: Trying private key: /root/.ssh/id_xmss
debug3: no such identity: /root/.ssh/id_xmss: No such file or directory
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
administrator@1.2.3.4: Permission denied (publickey).

进行以下修改权限操作解决问题:

shell 复制代码
[root@Master ]# chmod 700 /root/.ssh/id_rsa

参考

Alibaba Cloud: Putty PPK file to Xshell key file for use
CSDN: Putty的ppk文件转成Xshell使用的key文件
Access EC2 instance using Putty
How To Configure SSH Key-Based Authentication on a Linux Server
AWS User Guide for Linux Instances - Create key pairs

相关推荐
2201_7611990439 分钟前
nginx 负载均衡1
linux·运维·服务器·nginx·负载均衡
suri ..44 分钟前
【Linux】进程第三弹(虚拟地址空间)
linux·运维·服务器
害羞的白菜1 小时前
Nginx基础详解5(nginx集群、四七层的负载均衡、Jmeter工具的使用、实验验证集群的性能与单节点的性能)
linux·运维·笔记·jmeter·nginx·centos·负载均衡
纪伊路上盛名在1 小时前
如何初步部署自己的服务器,达到生信分析的及格线
linux·运维·服务器·python·学习·r语言·github
Betty’s Sweet1 小时前
[Linux]:线程(三)
linux·线程·信号量·生产者消费者模型
0DayHP1 小时前
HTB:Bike[WriteUP]
运维·服务器
DieSnowK1 小时前
[C++][第三方库][httplib]详细讲解
服务器·开发语言·c++·http·第三方库·新手向·httplib
程序员南飞3 小时前
ps aux | grep smart_webrtc这条指令代表什么意思
java·linux·ubuntu·webrtc
StrokeAce3 小时前
linux桌面软件(wps)内嵌到主窗口后的关闭问题
linux·c++·qt·wps·窗口内嵌
热爱嵌入式的小许7 小时前
Linux基础项目开发1:量产工具——显示系统
linux·运维·服务器·韦东山量产工具