Skip to content

Instantly share code, notes, and snippets.

@jjo
Last active January 29, 2022 22:46
Show Gist options
  • Save jjo/a19d19e589f8db6fa6faacda7128f36e to your computer and use it in GitHub Desktop.
Save jjo/a19d19e589f8db6fa6faacda7128f36e to your computer and use it in GitHub Desktop.

Revisions

  1. jjo revised this gist Jan 28, 2022. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions ssh-example-use.log
    Original file line number Diff line number Diff line change
    @@ -7,4 +7,6 @@ $ rsync vm-name.us-central1-a.some-project.gcp:

    # SSH agent forwarding ftW
    $ ssh -A vm-name.us-central1-a.some-project.gcp

    ## At VM prompt:
    vm-name $ git clone git@github:foo/private-repo
  2. jjo revised this gist Jan 28, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion dotssh-config-add.cfg
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    ### Add below stanza to your ~/.ssh/config
    ## Parsed as vmname.REGION.PROJECT.gcp
    Host *.*.*.gcp
    ProxyCommand gcloud beta compute ssh --tunnel-through-iap $(echo %h|awk -v FS=. '{ printf ("--project=%%s --zone=%%s %%s", $3, $1, $1) }') --command="nc -q0 localhost 22"
    ProxyCommand gcloud beta compute ssh --tunnel-through-iap $(echo %h|awk -v FS=. '{ printf ("--project=%%s --zone=%%s %%s", $3, $2, $1) }') --command="nc -q0 localhost 22"
  3. jjo created this gist Jan 28, 2022.
    4 changes: 4 additions & 0 deletions dotssh-config-add.cfg
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    ### Add below stanza to your ~/.ssh/config
    ## Parsed as vmname.REGION.PROJECT.gcp
    Host *.*.*.gcp
    ProxyCommand gcloud beta compute ssh --tunnel-through-iap $(echo %h|awk -v FS=. '{ printf ("--project=%%s --zone=%%s %%s", $3, $1, $1) }') --command="nc -q0 localhost 22"
    10 changes: 10 additions & 0 deletions ssh-example-use.log
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    # Plain ssh against some VM (replace vm-name, some-project names below)
    $ ssh vm-name.us-central1-a.some-project.gcp uname -r
    4.19.0-18-cloud-amd64

    # Or use any other ssh- backed tool, e.g:.
    $ rsync vm-name.us-central1-a.some-project.gcp:

    # SSH agent forwarding ftW
    $ ssh -A vm-name.us-central1-a.some-project.gcp
    vm-name $ git clone git@github:foo/private-repo