[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: detecting network change.



On Monday, January 12, 2026 12:07:59 PM CET, Tim Woodall wrote:
Is there a portable (not specific to how networking is configured) way of detecting a network change and forcing ssh to close.

At work I have an ubuntu laptop, when at my desk I'm using wired connection, when I go to a meeting it switches to wifi.

if you are using NetworkManager, there are always /etc/NetworkManager/dispatcher.d/pre-up.d/ and /etc/NetworkManager/dispatcher.d/pre-down.d/

you could put a script in /etc/NetworkManager/dispatcher.d/pre-down.d/ that kills all ssh clients.

maybe something like:

 #!/bin/bash
 pkill ssh

ymmv

greetings...


Reply to: