I have ssh running on boot, on my raspberry PI, it works fine, until the screen shuts off, or it goes into a sleep mode, or whatever its doing. Then ssh becomes unresponsive, and I cannot establish new connections. How can I prevent the raspberry pi from going into sleep mode?

  • 1
    I have ssh running on boot - That's needed to have access to it. When do you log in by ssh? How do you revoke the RasPi? By a keystroke on its keyboard? – Ingo Jan 3 at 20:15

Your question isn't clear to me, but I guess you are asking about the ssh client instead of the ssh server/sshd.

If so, you may find help in reviewing the ssh client parameters in /etc/ssh/ssh_config.

There is no sleep mode in RPi.

If that doesn't help, please try to add details to your question that provide clues we can use.


It depends if you're running the pi with peripherals or if it's running headless. If you have peripherals connected to it - then it's not clear whether you are trying to ssh into other hosts, or if you are attempting to ssh into the pi from another client.

If it headless, the same lack of clarity does apply but it is more likely you are referring to using the pi as a host and attempting access with a client machine. If that is the case then anytime your client machine enters into a sleep state (or is shutdown for that matter), the ssh session is ultimately resolved with a 'broken pipe'.

The length of time before the connection is severed is based on your ssh_config file (or sshd_config for server side settings) and particularly the AliveCountMax (this determines the amount of time that can pass before the connection is closed). Since your machine is in sleep mode, it is not sending any of the null packets that would be sent (based on the AliveInterval value).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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