串口初始化失败怎么办,修改ssh端口号不生效
如果您更改了sshd的监听端口,然后执行service sshd restart并重新打开ssh链接,则可以立即链接到sshd。 此外,netstat也可以找到新端口。
稍后更换端口,然后运行systemctl restart sshd,发现无法通过统一的链接操作进行链接。 此外,由于在firewalld中打开了规则,因此netstat也找不到ssh端口。
以下是systemctl status sshd后的结果
以前在现场修改端口,当时没有问题,所以我在虚拟机上做了同样的操作。
重新启动服务,检查服务的状态
代码1
2
3
4
5
6
7
8
9
10
11
12
13sshd.service-opensshserverdaemon
加载:加载(/usr/lib/systemd/system/sshd.service; 已启用vendor preset :已启用)
active : activating (自动重新开始)重新开始:退出代码(since sun 2017-04-0919336042336030 CST ); 786ms ago
DOCS:man:sshd(8)。
man:sshd_config(5) )。
process :30040 execstart=/usr/sbin/sshd-d $ options (code=exited,status=255 ) ) ) ) ) ) ) )。
mainPID:30040(code=exited,status=255 ) ) ) ) ) ) ) ) ) )。
apr 0919336042:30 localhost.localdomainsystemd [1] : startingopensshserverdaemon .
apr 0919336042:30 localhost.localdomainsystemd [1] : sshd.service : mainprocessexited,code=exited,status=
apr 0919336042336030 localhost.localdomainsystemd [1] : unit sshd.serviceenteredfailedstate。
apr 0919336042336030 localhost.localdomainsystemd [1] : sshd.service failed。
但是,这次停留在activating状态,在多次没有结果后,我选择了远程重启电脑,但最终还是卧床不起,又很好。
在随后的问题中,我的配置文件修复了端口22、端口8022这两个端口。 22号成功了
这样看是selinux的问题,一般的正式环境selinux也关闭了,所以我关闭了selinux,成功重新启动了服务
关闭selinux
代码1
2
3
4
5
6
7
8
9
10
11
查看SELinux的状态:
1、/usr/sbin/sestatus-v # # selinux status参数为enabled时选中
selinux status :启用
2、getenforce ##也可以用这个命令检查
关闭SELinux :
1、临时关机(不用重启机器) :
将setenforce0##Selinux设置为永久模式
#将#setenforce1Selinux设置为enforcing模式
2、修改配置文件需要重新启动机器:
修改/etc/selinux/config文件
将SELINUX=enforcing更改为SELINUX=disabled
重启机器就行了
以上是sshd修改端口后几次启动失败的介绍。 对linux的学习有帮助。 谢谢你关注编织梦想的人。