Skip to content

Instantly share code, notes, and snippets.

@fabiand
Last active December 15, 2023 07:18
Show Gist options
  • Save fabiand/ce62b4850685bce57c29c43ea95abf9e to your computer and use it in GitHub Desktop.
Save fabiand/ce62b4850685bce57c29c43ea95abf9e to your computer and use it in GitHub Desktop.
# virtctl is in your $PATH
# You are logged into a cluster
# Then the snippet below enables seamless ssh login.
# Usage `ssh [<user>@]<vmname>.<namespace>.ocp`
# "ocp" can be anything, for convenience replace with your cluster's base fqdn
host *.ocp
ProxyCommand virtctl port-forward --stdio=true %h %p
@dlbewley
Copy link

It could be nice if virtctl ssh could also read stdin/stdout so this configuration could be more obvious. eg.

Host *.ocp
  ProxyCommand virtctl ssh %r@%h --stdio=true

Even better if stdio=true was the default.

Right now this works tar cf - files | virtctl ssh cloud-user@vm -c 'tar xf -', but it would be wonderful if virtctl ssh behaved more like ssh and the -c could be omitted.

@fabiand
Copy link
Author

fabiand commented Apr 25, 2023

@dlbewley a neat idea. Is this something you could provide a PR for?

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