vmware虚拟机centos7记录一次无法连接shell的问题

185 阅读1分钟

问题:无法连接shell,但是可以连接数据库等软件

finalshell报错:连接主机... java.net.ConnectException: Connection refused: connect

解决过程

  • 判断防火墙22是否打开,结果防火墙是关闭了的

  • 检查IP是否正确:ip addr,结果ens33也是没有问题的

  • 检查sshd

    #测试sshd配置文件的语法是否正确
    sshd -t
    ​
    # 结果发现是修改sshd_config(配置长时间不断开)最后多了一个r的字母
    /etc/ssh/sshd_config: line 144: Bad configuration option: r
    /etc/ssh/sshd_config: terminating, 1 bad configuration options
    ​
    #修改配置
    vim /etc/ssh/sshd_config
    # 删除最后的r字母,再重启#重启sshd
    systemctl restart sshd.service
    ​
    #重启后就正确连接了