首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >系统etc在启动sshd时挂起,但是"/usr/sbin/sshd -D -f /etc/ssh/sshd_config &“工作。

系统etc在启动sshd时挂起,但是"/usr/sbin/sshd -D -f /etc/ssh/sshd_config &“工作。
EN

Server Fault用户
提问于 2021-08-20 20:24:47
回答 1查看 1K关注 0票数 0

CentOS 7.这里是/usr/lib/systemd/system/sshd.service

代码语言:javascript
复制
[Unit]
Description=OpenSSH server daemon
Documentation=man:sshd(8) man:sshd_config(5)
After=network.target sshd-keygen.service
Wants=sshd-keygen.service

[Service]
Type=notify
EnvironmentFile=/etc/sysconfig/sshd
ExecStart=/usr/sbin/sshd -D $OPTIONS
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartSec=42s

[Install]
WantedBy=multi-user.target

在sshd_config中未注释的所有内容:

代码语言:javascript
复制
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
SyslogFacility AUTHPRIV
AuthorizedKeysFile.ssh/authorized_keys
PasswordAuthentication yes
ChallengeResponseAuthentication no
GSSAPIAuthentication yes
GSSAPICleanupCredentials no
usePAM no # Had to change it to no from yes because the connection was dropping right after successfull auth
X11Forwarding yes
Subsystemsftp/usr/libexec/openssh/sftp-server

如果需要的话我很乐意提供其他的东西。感谢你的帮助!

EN

回答 1

Server Fault用户

发布于 2021-08-20 20:59:35

看起来你的sshd_config里有个错误

代码语言:javascript
复制
Subsystemsftp/usr/libexec/openssh/sftp-server

应该是

代码语言:javascript
复制
Subsystem sftp /usr/libexec/openssh/sftp-server

还有这个

代码语言:javascript
复制
AuthorizedKeysFile.ssh/authorized_keys

应该是

代码语言:javascript
复制
AuthorizedKeysFile .ssh/authorized_keys

此外,对配置进行语法检查。

代码语言:javascript
复制
sshd -t 
票数 0
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/1075218

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档