您的位置:首页 > 其它

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

2018-03-13 19:41 323 查看
自从上次重装阿里云搭建了Web服务器之后一直没有ssh连接过,今天再次连接时一直提示操作超时
ssh root@x.x.x.xssh: connect to host x.x.x.x port 22: Operation timed out

检查了机器的防火墙和阿里云的防火墙发现没有问题,然后修改了ssh端口连接依然不成功。
telnet可以连接成功说明不是防火墙问题
telnet x.x.x.x 10022Trying x.x.x.x...Connected to x.x.x.x.Escape character is '^]'.

于是添加-v参数查看连接时的debug信息
ssh -p 10022 root@x.x.x.x  -vOpenSSH_7.6p1, LibreSSL 2.6.2debug1: Reading configuration data /etc/ssh/ssh_configdebug1: /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 0debug1: key_load_public: No such file or directorydebug1: identity file /Users/jiangzhou/.ssh/id_rsa-cert type -1debug1: key_load_public: No such file or directorydebug1: identity file /Users/jiangzhou/.ssh/id_dsa type -1debug1: key_load_public: No such file or
4000
directorydebug1: identity file /Users/jiangzhou/.ssh/id_dsa-cert type -1debug1: key_load_public: No such file or directorydebug1: identity file /Users/jiangzhou/.ssh/id_ecdsa type -1debug1: key_load_public: No such file or directorydebug1: identity file /Users/jiangzhou/.ssh/id_ecdsa-cert type -1debug1: key_load_public: No such file or directorydebug1: identity file /Users/jiangzhou/.ssh/id_ed25519 type -1debug1: key_load_public: No such file or directorydebug1: identity file /Users/jiangzhou/.ssh/id_ed25519-cert type -1debug1: Local version string SSH-2.0-OpenSSH_7.6ssh_exchange_identification: read: Operation timed out

百度之后发现了很多说法,最终尝试可行方案:
1、首先通过阿里云后台登录到ECS
2、执行 
 chmod 600 /etc/ssh/*
 systemctl restart sshd
3、成功连接
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: