How to debug SSHD (SSH)

1 min read

Here are some steps/notes I took to help identify why we are getting these silly “client_loop: send disconnect: Broken pipe” messages

Client Side Troubleshooting

STEP ONE

First I start on the client side by adding verbose to my ssh connection

so instead of just going with

ssh user@hostORipaddress

instead use verbose by issuing this command

ssh -vvv user@hostORipaddress

You will see alot more data in your window that will hopefully help but if not let’s go to the next part

STEP TWO

Check to see if your connection is getting timed out by manually setting it for a longer period of time. In this example we will set it for 5minutes

ssh -vvv -o ServerAliveInterval=300 user@hostORipaddress

If you don’t last 5minutes then let’s move to the next troubleshooting step

Server Side Troubleshooting

STEP ONE

Check the logs to see whats going on

journalctl -u sshd

You may need to increase the Loglevel to help identify the issue so let’s do that

STEP TWO

Increasing the Loglevel we’ll need to edit the sshd_conf file but its always a good idea to back it up

cp -v /etc/ssh/sshd_config{,$(date +.%Y-%b-%d-%H-%M-%S)}

Now let’s go in and edit the file

sudo vi /etc/ssh/sshd_config

Change the Loglevel to DEBUG3

Save the file

:wq!

Restart sshd service

sudo systemctl restart sshd

Now watch those logs mentioned in STEP ONE

Leave a Reply