container optimized os ssh timeout too fast

32 Views Asked by At

how to fix GCP container optimized os ssh timeout too soon

its /etc/ssh/ssh_config has:

# Google Compute Engine times out connections after 10 minutes of inactivity.
# Keep alive ssh connections by sending a packet every 7 minutes.
ServerAliveInterval 420

but it close connection when idle for around 3 mins

client_loop: send disconnect: Broken pipe

Plus: its /etc/ is not stateful, which means what ever you change will be wipe out after reboot.

1

There are 1 best solutions below

0
C.K. On

for MacOS set ServerAliveInterval 120 in client's ~/.ssh/config

Host container_optimized_os
  ServerAliveInterval 120
  HostName ipaddr
  Port 22
  User username
  AddKeysToAgent yes