简体   繁体   中英

SSH login not working on centos due to bad sshd configuration

I was trying to configure SFTP on Centos server. I edited /etc/ssh/sshd_config file and restarted service. There was an error on Chroot line. After a while connection broke with server and from then, no one is ever able to login to server. Obviously, unable to correct sshd configuration as unable to login to server.

I have root details. Plesk is configured to the server to manage domains. Still not able to do much.

Below is error log when trying for ssh login:

debug1: Authentication succeeded (publickey).
Authenticated to *.*.*.* ([*.*.*.*]:*).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: channel 0: free: client-session, nchannels 1
Connection to *.*.*.* closed by remote host.
Connection to *.*.*.* closed.
Transferred: sent 3412, received 2164 bytes, in 0.1 seconds
Bytes per second: sent 54190.6, received 34369.4
debug1: Exit status -1

If your entire SSH config is just messed up, you may just want to uninstall it and then reinstall it.

From root or using sudo:

Erase:

# chkconfig sshd off
# service sshd stop
# yum erase openssh-server

Install:

# yum –y install openssh-server openssh-clients
# systemctl start sshd

That's a really broad solution, if you have more details I may be able to help you further.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM