https://stackoverflow.com/questions/41318597/ssh-connection-refused-on-raspberry-pi

vim /etc/ssh/sshd_config
or if you are accessing it with a non-root user with sudo privileges, type:
sudo vim /etc/ssh/sshd_config
3. From there, you want to type i for INSERT (to edit your file) and find the option that says PasswordAuthentication no and update it to
PasswordAuthentication yes
Then, type:
esc
followed by:
:wq
to write and quit out of the file, followed by hitting enter.
The problem is having wrong mod on the file.
Easily solved by executing –
chmod 400 mykey.pem
Taken from Amazon’s instructions –
Your key file must not be publicly viewable for SSH to work. Use this command if needed: chmod 400 mykey.pem
And hit dd command to delete line. Save and close the file. Or use following
vi ~/.ssh/known_hosts
OR
vi /var/root/.ssh/known_hosts
Now go to line # 2, type the following command
:2
Now delete line with dd and exit:
dd
:wq
https://www.cyberciti.biz/faq/warning-remote-host-identification-has-changed-error-and-solution/