unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Need Help With Emacs Tramp Mode For 'gcloud compute ssh'
@ 2021-08-09  3:03 Samuel Banya
  2021-08-09 15:41 ` Michael Albinus
  0 siblings, 1 reply; 4+ messages in thread
From: Samuel Banya @ 2021-08-09  3:03 UTC (permalink / raw)
  To: help-gnu-emacs

Hello there,

I have looked high and low on the internet, and can't find a decent answer on how to utilize Tramp Mode for 'gcloud compute ssh'.

This is the command I need to run for work, since I remote into gcloud (GCP) based jump boxes, so I need to use the '--project' parameter accordingly:
gcloud compute ssh --project ops-dist-(client's environment name) (client's environment name)-cli

I have the following present in my Emacs config so far, but am completely stuck as all there's to go off is the source code itself, and I really only use Org Mode and Emacs for notes, and super light programming:

** WORK-SPECIFIC Add 'tramp' to easily ssh into gcp jumpbox and ssh into 'aa-master'
#+BEGIN_SRC emacs-lisp
  (use-package tramp
    :ensure t
    :config
    (add-to-list 'tramp-methods
'("gcssh"
   (tramp-login-program "gcloud compute ssh")
   (tramp-login-args (("%h --project example-project example-project-cli")))
   (tramp-async-args (("-q")))
   (tramp-remote-shell "/bin/bash")
   (tramp-remote-shell-args ("-c"))
   (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
   ("-o" "UserKnownHostsFile=/dev/null")
   ("-o" "StrictHostKeyChecking=no")))
   (tramp-default-port 22))))

  (defun gcp-box-connect ()
    (interactive)
    (find-file "/gcssh:compute-instance:/path/to/filename.clj"))

  ;; NOTE: Uncommenting when I figure out the full path to what I need to add and will most likely add it to a 'secrets' file:
  ;; Suggested format:
  ;; C-x C-f /gcssh:compute-instance:/path/to/filename.clj
  (global-set-key (kbd "C-M-g") 'gcp-box-connect)
#+END_SRC


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-10 12:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-09  3:03 Need Help With Emacs Tramp Mode For 'gcloud compute ssh' Samuel Banya
2021-08-09 15:41 ` Michael Albinus
2021-08-09 17:04   ` Samuel Banya
2021-08-10 12:55     ` Michael Albinus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).