Running EC2 instance suddenly refuses SSH connection

后端 未结 9 858
小鲜肉
小鲜肉 2020-12-14 08:42

I\'ve set up the EC2 instance couple days ago and even last night I was able to SSH to it with no problems. Today morning, I can\'t ssh to it. Port 22 is already open in the

9条回答
  •  难免孤独
    2020-12-14 08:55

    This happened to me on a Red Hat EC2 instance because these two lines were being automatically appended the end of the /etc/ssh/sshd_config file every time I launched my instance:

    PermitRootLogin without-password
    UseDNS no

    One of these append operations was done without a line break, so the tail of the sshd_config file looked like:

    PermitRootLogin without-password
    UseDNS noPermitRootLogin without-password
    UseDNS no

    That caused sshd to fail to start on the next launch. I think this was caused by the bug reported here: https://bugzilla.redhat.com/show_bug.cgi?id=956531 The solution was to remove all the duplicate entries at the bottom of the sshd_config file, and add extra line breaks at the end.

提交回复
热议问题