Skip to content

Instantly share code, notes, and snippets.

@brevans
Created February 17, 2017 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brevans/763964b4bdbae66cede676f781bf6b5d to your computer and use it in GitHub Desktop.
Save brevans/763964b4bdbae66cede676f781bf6b5d to your computer and use it in GitHub Desktop.
openssh config to allow sharing of multiple sessions over a single network connection
#!/bin/bash
if [ ! -f ~/.ssh/config ]; then
touch ~/.ssh/config
chmod 644 ~/.ssh/config
fi
mkdir -p ~/.ssh/tmp
if grep -iq 'ControlMaster' ~/.ssh/config; then
echo "ControlMaster options already set, please check ~/.ssh/config"
else
sed -i.bak "1s@^@ControlMaster auto\nControlPath ${HOME}/.ssh/tmp/%h_%p_%r\n\n@" ~/.ssh/config
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment