首页 > 解决方案 > Not able to connect to AWS server using linux terminal after a reboot with "sudo service sshd restart". Getting “Connection timed out” error

问题描述

I was trying to edit the sshd_config file and in between that my machine crashed. When I tried again it started showing the below message-

Found a swap file by the name "/etc/ssh/.sshd_config.swp"
dated: Mon Oct 23 07:17:17 2017  [cannot be read]
  While opening file "/etc/ssh/sshd_config"
  dated: Mon Oct 23 22:19:04 2017
  NEWER than swap file!

(1) Another program may be editing the same file.  If this is the case,
    be careful not to end up with two different instances of the same
    file when making changes.  Quit, or continue with caution.
(2) An edit session for this file crashed.
    If this is the case, use ":recover" or "vim -r /etc/ssh/sshd_config"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file "/etc/ssh/.sshd_config.swp"
    to avoid this message.*

I deleted the .swp file but it looks like the original file got deleted. After that I ran this command "sudo service sshd restart ".

Now I am not able to connect to the AWS server using linux terminal. Can anyone please help me with this

标签: linuxamazon-web-servicessshopensshamazon-lightsail

解决方案


原始文件不应该被删除...... .swp 文件是正在进行的编辑。

您是否尝试过重启实例?

如果这没有帮助,您可能需要从快照中恢复。您确实在编辑 ssh 配置之前拍摄了快照,对吧?


推荐阅读