Xshell连接linux服务器不成功的乌龙问题

2019/01/13 15:00
阅读数 600

一般xshell连接linux服务器不成功有以下几个问题:

  • linux防火墙拦截,导致Xshell不能访问linux

    操作方法:

     firewalld(CentOS7):启动 :systemctl start firewalld

               关闭:systemctl stop firewalld

               查看状态:systemctl status firewalld

               开机禁用:systemctl disable firewalld

               开机启用:systemctl enable firewalld

     iptables防火墙的操作方法与firewalld防火墙相同,只是在不同环境下可能需要将 systemctl 换成service

  • 22端口被占用

    查看方法:netstat -tunlp|grep 22   查看端口使用情况

         lsof -i:22  查看端口属于哪一个程序

         如果不是sshd进程的话  则  kill -9 进程id  杀死进程

  • 修改sshd_config配置文件

    用root权限打开  /etc/ssh/sshd_config文件

    修改  PermitRootLogin no  改为 PermitRootLogin yes

    之后重启服务  service sshd restart 

 

 

笔者执行完以上三种方式扔仍没有解决问题,最后发现在登录linux虚拟机时输入的密码是按的键盘右侧的数字键。因为当时的数字键是锁定的状态,输入时并不是输入的空,而是其他字符,导致root密码根本就不是自己记录的密码。所以当在xshell里面输入密码时因为密码错误登录不上。

因为这个问题耽误了两天的时间,实在是乌龙,记录在册,希以鞭策。

 

      

展开阅读全文
加载中
点击加入讨论🔥(1) 发布并加入讨论🔥
打赏
1 评论
0 收藏
0
分享
返回顶部
顶部