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