Skip to content

Instantly share code, notes, and snippets.

@nhtzr
Last active June 2, 2022 03:49
Show Gist options
  • Save nhtzr/ba4caab8a937f4cdf4fb546350d1222b to your computer and use it in GitHub Desktop.
Save nhtzr/ba4caab8a937f4cdf4fb546350d1222b to your computer and use it in GitHub Desktop.
my .ssh/config
Host */*
ProxyCommand ssh %r@$(dirname %h) -W $(basename %h):%p
Host *_*
ProxyCommand ssh %r@$(cut -f1 -d_ <<< '%h') -W $(: '%h'; echo "${_##*_}"):%p
# SSH over Session Manager
Host aws-ssm-*
ProxyCommand sh -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment