【发布时间】:2017-11-11 01:57:01
【问题描述】:
我正在安装一个新的 CentOS7,它的 sshd 服务运行良好。然后我下载了openssh7.5p1的源码,编译安装到默认目录“/usr/local/sbin/sshd”。我想用它来替换系统的sshd。
我修改文件“/usr/lib/systemd/system/sshd.service”,更改以下行:
old: ExecStart=/usr/sbin/sshd $OPTIONS new: ExecStart=/usr/local/sbin/sshd $OPTIONS之后,输入命令“service sshd start”,命令无法返回,似乎挂了。如下所示:
[root@localhost ~]# service sshd start Redirecting to /bin/systemctl start sshd.service我按下 Ctl+C 来终止命令。然后使用命令“netstat -ntlp”发现“sshd”已经启动,不知道为什么“service sshd start”不能返回提示。
[root@localhost ~]# netstat -ntlp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 2443/dnsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 63144/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1043/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1815/master
tcp6 0 0 :::111 :::* LISTEN 1/systemd
tcp6 0 0 :::22 :::* LISTEN 63144/sshd
tcp6 0 0 ::1:631 :::* LISTEN 1043/cupsd
tcp6 0 0 ::1:25 :::* LISTEN 1815/master我尝试手动启动 sshd,它工作正常,sshd 启动成功(没有任何警告消息)并且命令立即返回。命令如下:
[root@localhost ~]# /usr/local/sbin/sshd -f /etc/ssh/sshd_config
感谢任何帮助。如果您想了解更多信息,请告诉我。谢谢。
【问题讨论】:
-
日志中有什么内容?你能提供
journalctl -u sshd的输出吗?
标签: linux service centos7 systemd sshd