ssh登录有问题?

1.判断物理链路是否连通 ping 192.168.25.130
 主要为了检测是否与网卡为同一个网段的IP
2.判断ssh服务是否正常 systemctl status sshd
 查看配置文档中是否阻止了某些用户的登录,例如在配置文档中设置了白名单,此时root用户便不允许登录。

[root@localhost ~]# systemctl status sshd 
● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2019-07-29 00:34:50 EDT; 2 days ago
     Docs: man:sshd(8)
           man:sshd_config(5)
 Main PID: 1522 (sshd)
   CGroup: /system.slice/sshd.service
           └─1522 /usr/sbin/sshd -D

Jul 29 00:34:50 localhost.localdomain systemd[1]: Started OpenSSH server daemon.
Jul 29 00:34:50 localhost.localdomain systemd[1]: Starting OpenSSH server daemon...
Jul 29 00:34:52 localhost.localdomain sshd[1522]: Server listening on 0.0.0.0 port 22.
Jul 29 00:34:52 localhost.localdomain sshd[1522]: Server listening on :: port 22.
Jul 30 22:36:07 localhost.localdomain sshd[8276]: Accepted password for redhat from 192...h2
Jul 30 22:36:30 localhost.localdomain sshd[8480]: Accepted password for redhat from 192...h2
Hint: Some lines were ellipsized, use -l to show in full.

[root@localhost ~]# vim /etc/ssh/sshd_config
检查配置文档中的信息是否限制了某些权限

3.Linux防火墙

[root@localhost ~]# firewall-cmd --list-all
public (default)
  interfaces: 
  sources: 
  services: dhcpv6-client ssh
  ports: 
  masquerade: no
  forward-ports: 
  icmp-blocks: 
  rich rules: 

默认只允许以上两种服务,其余的都会被拒绝,所以如果不是以上两种协议都要关掉防火墙

[root@localhost ~]# setenforce 0

5、将网络适配器选择为自定义。在这里插入图片描述
5.测试:
ssh root@192.168.40.132

ssh连接不上:
开启ssh,可以用工具链接服务器
先安装 apt-getinstall ssh 或者 sudo apt-getinstall openssh-client
然后改配置: vi /etc/ssh/sshd_config
1.将#PasswordAuthentication no的注释去掉,并且将NO修改为YES    //kali中默认是yes · 
2.将#PermitRootLogin without-password修改为 PermitRootLogin yes 并去掉注释  
启动SSH服务 命令为:
/etc/init.d/ssh start  或者 service ssh start
查看SSH服务状态是否正常运行,命令为:
 /etc/init.d/ssh status 或者 service ssh status
系统自动启动ssh :  update-rc.d ssh enable 
查看IP信息:ip addr

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值