I am trying to troubleshoot a startup script. This necessitates multiple reboots and restarting ssh sessions. At seemingly random times the pi becomes ornery.

ssh -vvv -p 22

OpenSSH_7.1p2, OpenSSL 1.0.1g 7 Apr 2014
debug1: Reading configuration data /etc/ssh_config
debug2: ssh_connect: needpriv 0
debug1: Connecting to [] port 22.
debug1: connect to address port 22: Connection refused
ssh: connect to host port 22: Connection refused

the pi is alive and well


Pinging with 32 bytes of data:
Reply from bytes=32 time=5ms TTL=64
Reply from bytes=32 time=5ms TTL=64
Reply from bytes=32 time=4ms TTL=64
Reply from bytes=32 time=7ms TTL=64

It just doesnt want to ssh. When the hdmi cable is connected, the boot sequence looks fine. I have to shut it off by disconnecting the power and then restarting it - then the pi is ssh-able again. The pi is configured to connect to my local wifi with the appropriate credentials in wpa_supplicant.conf and the static ip in dhcpd.conf and it works well, most of the time.

2 Answers 2


ssh -vvv -p 22 will attempt to connect to the Pi as whatever user is on whatever machine you are using to ssh - which almost certainly doesn't exist.

Try ssh [email protected]

  • was actually using moba term which stores the session info so it is sent the same way every time. hard shutoff of the pi fixes it so its not a typo issue. May 11, 2018 at 15:11

In /etc/ssh/sshd_config on your raspi you can set the LogLevel to one of QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3 for your ssh server (man sshd_config). I suggest to set it to one of the debug level, restart the ssh server and look at the logging files if you can find the reason why the connection is refused.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.