Run command before open a tunnel


Is it possible to run a command before opening a tunnel.
I would like to start a "SecurID-App" to get the password for the 2FA authentication.

Best Regards

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,


Hell Yang,

thank you for your help.
A line with a Match directive in .ssh/config was the solution:

Match host myhost exec "/Users/uuuuu/"

Kindly Regards,

1 Like