记录一次阿里云ssh登录失败原因

自从上次重装阿里云搭建了Web服务器之后一直没有ssh连接过,今天再次连接时一直提示操作超时

ssh root@x.x.x.x

ssh: connect to host x.x.x.x port 22: Operation timed out


检查了机器的防火墙和阿里云的防火墙发现没有问题,然后修改了ssh端口连接依然不成功。

telnet可以连接成功说明不是防火墙问题

telnet x.x.x.x 10022

Trying x.x.x.x...

Connected to x.x.x.x.

Escape character is '^]'.


于是添加-v参数查看连接时的debug信息

ssh -p 10022 root@x.x.x.x  -v

OpenSSH_7.6p1, LibreSSL 2.6.2

debug1: Reading configuration data /etc/ssh/ssh_config

debug1: /etc/ssh/ssh_config line 48: Applying options for *

debug1: Connecting to x.x.x.x port 10022.

debug1: Connection established.

debug1: identity file /Users/jiangzhou/.ssh/id_rsa type 0

debug1: key_load_public: No such file or directory

debug1: identity file /Users/jiangzhou/.ssh/id_rsa-cert type -1

debug1: key_load_public: No such file or directory

debug1: identity file /Users/jiangzhou/.ssh/id_dsa type -1

debug1: key_load_public: No such file or directory

debug1: identity file /Users/jiangzhou/.ssh/id_dsa-cert type -1

debug1: key_load_public: No such file or directory

debug1: identity file /Users/jiangzhou/.ssh/id_ecdsa type -1

debug1: key_load_public: No such file or directory

debug1: identity file /Users/jiangzhou/.ssh/id_ecdsa-cert type -1

debug1: key_load_public: No such file or directory

debug1: identity file /Users/jiangzhou/.ssh/id_ed25519 type -1

debug1: key_load_public: No such file or directory

debug1: identity file /Users/jiangzhou/.ssh/id_ed25519-cert type -1

debug1: Local version string SSH-2.0-OpenSSH_7.6

ssh_exchange_identification: read: Operation timed out


百度之后发现了很多说法,最终尝试可行方案:

1、首先通过阿里云后台登录到ECS

2、执行 

 chmod 600 /etc/ssh/*

 systemctl restart sshd

3、成功连接


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值