Skip to content

Instantly share code, notes, and snippets.

@ueokande
Created October 9, 2015 13:38
Show Gist options
  • Save ueokande/cfd925f6749f71886096 to your computer and use it in GitHub Desktop.
Save ueokande/cfd925f6749f71886096 to your computer and use it in GitHub Desktop.
Generate SSH config
#!/bin/ruby
def add_host(host, options = {})
puts "Host #{host}"
options.each do |k, v|
puts "#{k} #{v}"
end
puts
end
add_host 'git', hostname: 'git.example.com', user: 'git'
add_host 'web', hostname: 'web.example.com', port: 11111, user: 'admin'
@ueokande
Copy link
Author

Init as

mkfifo ~/.ssh/config

and use as in .bashrc

while true; do ~/bin/gen_ssh_config >~/.ssh/config; done &

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment