I was having two opposite problems at the same time:
The important thing here is "ServerAliveInterval 0".
Make sure the ssh_config spec for "ControlPath" includes the "%n" token. Again, refer to the man-page.
nb, if you're testing this, make sure any persistent shared connections are closed with "ssh -O exit ac68u.lan", otherwise you'll just be reconnecting to the same ssh tunnel, and the config changes won't have any effect.
Next problem: When running a command like:
I've had too many problems with the ssh connection dying, but the command just hangs, acting like everything is fine. In these cases, I want the ssh command to exit if the connection isn't passing data. In these cases, I want an idle connection to make the ssh command exit. Back to my "~/.ssh/config"
This creates an alias "sh.ac68u.lan", and when I ssh to that, it sends a "ServerAlive" packet every five seconds (ServerAliveInterval 5), and if two of them (ServerAliveCountMax 2) don't get answered (and they won't; dropbear just ignores them) the connection will die after ten seconds.
Use "ssh -G" to check that it's doing what you think it's doing.
Also, you can use "ssh -vvvv". This will show ServerAlive as "debug3: send packet: type 80". If there are responses, they'll show up as "debug3: receive packet: type 82". Don't expect any responses from dropbear, but this can be tested with other ssh servers.
- Interactive ssh logins to the AC68U would drop out randomly, and
- non-interactive ssh logins would hang indefinitely after the connection died
Code:
Host ac68u.lan
HostName RT-AC68U-1234.lan
User admin
ConnectTimeout 10
RequestTTY yes
ServerAliveInterval 0
Make sure the ssh_config spec for "ControlPath" includes the "%n" token. Again, refer to the man-page.
nb, if you're testing this, make sure any persistent shared connections are closed with "ssh -O exit ac68u.lan", otherwise you'll just be reconnecting to the same ssh tunnel, and the config changes won't have any effect.
Next problem: When running a command like:
Code:
ssh sh.ac68u.lan 'cat /dev/urandom' > /tmp/file
I've had too many problems with the ssh connection dying, but the command just hangs, acting like everything is fine. In these cases, I want the ssh command to exit if the connection isn't passing data. In these cases, I want an idle connection to make the ssh command exit. Back to my "~/.ssh/config"
Code:
## create an alias for remote commands
## and let this one break connections if it goes quiet
Host sh.ac68u.lan
HostName RT-AC68U-1234.lan
User admin
ConnectTimeout 10
RequestTTY no
ServerAliveInterval 5
ServerAliveCountMax 2
Use "ssh -G" to check that it's doing what you think it's doing.
Also, you can use "ssh -vvvv". This will show ServerAlive as "debug3: send packet: type 80". If there are responses, they'll show up as "debug3: receive packet: type 82". Don't expect any responses from dropbear, but this can be tested with other ssh servers.
Last edited: