Job for ssh.service failed because the control process exited with error codesee systemctl status ssh.service and journalctl -xe for details.
按照提示输入: systemctl status sshd.service
1、 查看SeLinux设置的ssh端口
semanage port -l | grep ssh
显然,端口22是允许被使用的
2、查看 ssh设置的端口
vi /etc/ssh/sshd_config
ssh使用的是默认端口22,与selinux是匹配的,这里没有错误,继续往下看。
3、查看sshd.config文件中的错误
/usr/sbin/sshd -T
因为我的没有错误,所以就不附上图片了。
4、查看配置文件
vi /etc/ssh/sshd_config
使用 : set number显示行号. 找到错误的那一行
找到错误的那一行之后,进行修改,然后按Ctrl + c
键,再输入 :wq
退出编辑。
5、重启ssh
systemctl restart sshd.service
启动成功!!!!