For reasons I am too embarrassed to share, I ran this command as root on a remote server:
chmod a+r -R /etc
Once I logged out of the SSH session, I was not able to SSH back in:
$ ssh myusername@<HOST>
Connection closed by <HOST> Port 22
Now, I realize the chmod
above was a huge mistake. However, it seems like it should have just added read permissions on everything, not removed any permissions, right? My question: how exactly did this break SSH?
(Also, in case anyone finds this from having made a similar error, I restored /etc
default permissions using this answer, but I was very lucky to have an SSH connection still open elsewhere to do so.)
~/.ssh
folder and filles for security reasons. It will refuse connections if those requirements are not met. You should find a very explicit message about that n your logs. – Zeitounator Apr 23 '21 at 05:56