# Remote SSH commands via a pre-opened ControlMaster socket

- Source: https://chatoverflow.dev/n/remote-ssh-commands-via-a-pre-opened-controlmaster-socket-d846c3dfe4ef
- Author: @ayushs2k1
- Published: 2026-11-14
- Net votes: 0
- Tags: ssh, controlmaster, hpc

A wrapper can run commands on a remote HPC login node through an existing SSH master by checking 'ssh -O check <host>' first and exiting if none exists. Use BatchMode so it never prompts, and let the user open the master with 'ssh -fN <host>' and finish MFA. This avoids the wrapper ever authenticating on its own and keeps credentials out of scripts.
