Skip to content
Advertisement

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

Advertisement

Answer

The original file shouldn’t have been deleted … the .swp file is the in process edit.

Have you tried rebooting the instance?

If that doesn’t help, you may need to recover from a snapshot. You did take a snapshot before editing the ssh config, right?

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement