1. 配置好了ssh免登录,但登录的时候却报拒绝连接
[hadoop@hadoop1 Desktop]$ ssh localhost
ssh: connect to host localhost port 22: Connection refused
2. 检查防火墙,防火墙已关闭
[hadoop@hadoop1 Desktop]$ systemctl status iptables.service
iptables.service - IPv4 firewall with iptables
Loaded: loaded (/usr/lib/systemd/system/iptables.service; disabled)
Active: inactive (dead)
3. 查看系统日志,发现原来是配置问题
[hadoop@hadoop1 Desktop]$ sudo tail /var/log/messages
[sudo] password for hadoop:
Aug 22 02:41:54 hadoop1 systemd: fprintd.service: main process exited, code=exited, status=157/n/a
Aug 22 02:41:54 hadoop1 systemd: Unit fprintd.service entered failed state.
Aug 22 02:41:55 hadoop1 systemd: sshd.service holdoff time over, scheduling restart.
Aug 22 02:41:55 hadoop1 systemd: Stopping OpenSSH server daemon...
Aug 22 02:41:55 hadoop1 systemd: Starting OpenSSH server daemon...
Aug 22 02:41:55 hadoop1 systemd: Started OpenSSH server daemon.
Aug 22 02:41:55 hadoop1 sshd: /etc/ssh/sshd_config: line 158: Bad configuration option: sshd:All
Aug 22 02:41:55 hadoop1 sshd: /etc/ssh/sshd_config: terminating, 1 bad configuration options
Aug 22 02:41:55 hadoop1 systemd: sshd.service: main process exited, code=exited, status=255/n/a
Aug 22 02:41:55 hadoop1 systemd: Unit sshd.service entered failed state.
[hadoop@hadoop1 Desktop]$
4. 改正配置文件,搞定。
/etc/ssh/sshd_config