Run command before open a tunnel

There is a few ways:

  1. Use ProxyCommand
  2. Or Match directive
  3. And last one, Use AppleScript to automate tasks

Both ProxyCommand and Match ways require you install and enable Core Helper, and then edit and set directives in ~/etc/.ssh/config file.

Let me know if you need assistance.

Kindly Regards,

Yang