1、UsePAM阻挡:
在部分环境里启用UsePAM可阻挡用户,可修改为no再进行测试
vi /etc/ssh/sshd_config 编辑文件
UsePAM no 修改yes为no
systemctl restart sshd 重启生效
(no不启用UsePAM认证,yes启用,对应的文件在/etc/pam.d/sshd)
2、Root用户被禁止登陆:
cat /etc/ssh/sshd_config |grep PermitRootLogin (HIKOS默认为no)
(no表示禁止root远程登录,yes表示启用)
如果要启用,执行:
vi /etc/ssh/sshd_config 编辑文件
PermitRootLogin yes
systemctl restart sshd 重启生效
3、SELinux服务启用阻挡用户登陆:
cat /etc/selinux/config |grep “SELINUX=” |grep -v ^#
SELinux=disabled表示禁用SELinux,如果SELINUX=enforcing表示启用。
永久关闭:
vi /etc/selinux/config
SELINUX=enforcing修改为SELINUX=disabled
reboot重启主机
临时关闭:setenforce 0
4、防火墙未开放ssh端口:
netstat -anp|grep sshd 查看监听端口为55555
firewall-cmd –list-all public处于active状态,55555/tcp已开放。
如果没有开放,执行以下命令开放:
[root@test02 ~]# firewall-cmd –add-port=55555/tcp –permanent
success
[root@test02 ~]# firewall-cmd –reload
success
5、IP地址冲突:
使用arp-scan进行IP地址扫描确认是否冲突
arp-scan -I(大写i) 网卡名 网段/掩码
示例:
arp-scan -I ens192 10.2.148.0/24
用iptools.sh重新配置一遍现有IP
6、弱密码被PAM阻挡:
重置hik密码为1qaz#EDC再进行测试
echo hik:1qaz#EDC|chpasswd – c
7、ssh算法不匹配:
升级过openssh导致现有的xshell或者crt因算法不匹配导致连接不上的情况
找不到匹配的Key exchange算法
vi /etc/ssh/sshd_config 在末尾追加3行增加以下内容:
KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa
ssh低版本访问高版本(openssh8.8)时报错: no hostkey alg。
在ssh配置文件/etc/ssh/sshd_config添加以下两行:
HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa
ssh高版本(openssh8.8)访问低版本时报错:
Unable to negotiate with x.x.x.x port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss
在/root/.ssh/config文件中添加以下两行:
HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa
systemctl restart sshd 重启sshd生效
或者下载其他工具
MobaXterm_CHS下载地址
https://drive.hikvision.com/hcs/controller/hik-manage/fileDownload?link=cmIAPFmZ&
本文由 @我是pm 发布于弱电智能网 。
题图来自Unsplash,基于CC0协议
内容观点仅代表作者本人,弱电智能网平台仅提供信息存储空间服务。
如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
文章名称:《海康威视服务器Hikos系统SSH无法登录?》
文章链接:https://www.ruodian360.com/tech/sytemops/51573.html
添加微信ydian188免费入群,记得备注“弱电智能网”。