How to resole “ssh localhost” failed when config Hadoop

有三种情况:

1. ssh localhost
error: connection refused at port 22

solution:

use root user to edit /etc/ssh/sshd_conf add:

ListenAddress 0.0.0.0:22

and

/etc/init.d/sshd restart

2. ssh localhost
error: Permission denied (publickey,gssapi-with-mic)

solution:

disable gssapi in /etc/ssh/sshd_conf:

GSSAPIAuthentication no

and

/etc/init.d/sshd restart

3. ssh localhost
error: Permission denied (publickey)
when view /var/log/secure
Authentication refused: bad ownership or modes for file /home/adwiser/.ssh/authorized_keys

solution:

Check there permissions on the ~/.ssh directory should be 700,
and the authorized_keys file should be 600

so execute shell:

chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys