centos7:
问题:连接本地虚拟机时,连接不上,报错--Network error: Connection refused原因:1.刚开始直接ping主机,是可以ping通的,说明网络是正常的[root@szb ~]# ping 192.168.8.132PING 192.168.8.132 (192.168.8.132) 56(84) bytes of data.64 bytes from 192.168.8.132: icmp_seq=1 ttl=64 time=0.969 ms64 bytes from 192.168.8.132: icmp_seq=2 ttl=64 time=4.00 ms2.查询sshd安装了没,说明是存在的[ly@192 ~]$ ps -e |grep ssh 8245 ? 00:00:00 ssh-agent 3.ss -ntl 查询22端口是否开启,此处没有22端口[ly@192 ~]$ ss -ntlState Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 5 192.168.122.1:53 *:* LISTEN 0 128 127.0.0.1:631 *:* LISTEN 0 128 [::1]:631 [::]:* 解决办法:确认一下是否还是默认的端口,vim /etc/ssh/sshd_config,显示没有被修改4.重启sshd服务,在查看端口,已经存在22端口了,MobaXterm软件重连接,可以了systemctl restart sshd
ubuntu20.04
报错:root@192.168.8.141's password:Access denied排查路径:1.查看sshd相关服务是否存在apt-get install openssh-serversystemctl restart ssh # 重启 openssh server2.查看22端口是否存在ss -ntl3.将密码拒绝远程访问改一下配置root@ubuntu:~# vim /etc/ssh/sshd_config #PermitRootLogin prohibit-password改为PermitRootLogin yessystemctl restart ssh