I have a Raspberry Pi 2 B connected on the network with a static IP.

After a fresh reboot, I can connect to it smoothly and it just works: ssh -A <ip> -p <port>.

But after, let's say one day or more, the ssh request hangs and I don't know why. ping <ip> works fine, and it doesn't seem to be frozen completely.

The SSH connection simply hangs, tho.

How can I inspect this problem? What is the solution?

I'm running Ubuntu Mate on it.


The first step to analyze problems with ssh is to start the connection with verbose output:

~$ ssh -v user@<ip> -p <port>

You can improve verbosity of the debug output with -vv or -vvv but I suggest to start with -v to get an overview.

Try to connect without forwarding of the authentication agent connection (option -A), because it is unclear what the authentication agent is doing after a day.

| improve this answer | |
  • I've just tried this, and it simply hangs: Connecting to <host> port <port>. – Ionică Bizău Aug 15 '19 at 19:09
  • I have vncserver running on another port, and it has exactly the same problem. On the same pi I have a cronjob which sends system data every 10 minutes, and the CPU/Memory are low (because there is nothing expensive which runs on the machine). I can't understand why it would block these connections. I have another RPi around, configured exactly the same way and it works nicely. – Ionică Bizău Aug 15 '19 at 19:14
  • @IonicăBizău Sorry, but I cannot help much more. I do not have any experience with Ubuntu Mate. – Ingo Aug 15 '19 at 19:18

ssh connections timeout after a period of inactivity. This is unlikely to be the Pi, but the client timeout, although the network connection may timeout on inactivity.

You can set ssh timeout on the Pi, but you would be better to do this on your ssh client. This causes to client to send a keep alive message at regular intervals, and it will only disconnect if no response is received.

Alternatively just start a new ssh session!

| improve this answer | |
  • Sorry, I am asking about new connections -- I am not leaving the SSH connection open one day, but I want to connect after one day again... and it just hangs. – Ionică Bizău Aug 8 '19 at 3:54

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.