CentOS 7.这里是/usr/lib/systemd/system/sshd.service
[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中未注释的所有内容:
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如果需要的话我很乐意提供其他的东西。感谢你的帮助!
发布于 2021-08-20 20:59:35
看起来你的sshd_config里有个错误
Subsystemsftp/usr/libexec/openssh/sftp-server应该是
Subsystem sftp /usr/libexec/openssh/sftp-server还有这个
AuthorizedKeysFile.ssh/authorized_keys应该是
AuthorizedKeysFile .ssh/authorized_keys此外,对配置进行语法检查。
sshd -t https://serverfault.com/questions/1075218
复制相似问题