* 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
* Re: Need Help With Emacs Tramp Mode For 'gcloud compute ssh'
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
0 siblings, 1 reply; 4+ messages in thread
From: Michael Albinus @ 2021-08-09 15:41 UTC (permalink / raw)
To: Samuel Banya; +Cc: help-gnu-emacs
"Samuel Banya" <sbanya@fastmail.com> writes:
> Hello there,
Hi Samuel,
> 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'.
Which Emacs/Tramp version are you using?
> (add-to-list 'tramp-methods
> '("gcssh"
> (tramp-login-program "gcloud compute ssh")
This must be exactly the program name. "gcloud" I guess. "compute" and
"ssh" must be part of tramp-login-args.
> (tramp-login-args (("%h --project example-project example-project-cli")))
"%h" must be an element of its own. Somethging like
(tramp-login-args (("compute ssh") ("%h") ("--project example-project example-project-cli")))
> (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
> ("-o" "UserKnownHostsFile=/dev/null")
> ("-o" "StrictHostKeyChecking=no")))
tramp-gw-args do not exists for years. Likely, you don't need them.
When you have adapted your config, set also tramp-verbose to 6. Run the
test. If it fails, there will be a Tramp debug buffer, which tells
more. In case you need help to analyze, show it here.
Best regards, Michael.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Need Help With Emacs Tramp Mode For 'gcloud compute ssh'
2021-08-09 15:41 ` Michael Albinus
@ 2021-08-09 17:04 ` Samuel Banya
2021-08-10 12:55 ` Michael Albinus
0 siblings, 1 reply; 4+ messages in thread
From: Samuel Banya @ 2021-08-09 17:04 UTC (permalink / raw)
To: Michael Albinus; +Cc: help-gnu-emacs
Hello Michael,
I am currently using the latest Emacs Version 27.2.
This is specifically for my work Macbook running MacOSX Big Sur (latest).
On Mon, Aug 9, 2021, at 11:41 AM, Michael Albinus wrote:
> "Samuel Banya" <sbanya@fastmail.com> writes:
>
> > Hello there,
>
> Hi Samuel,
>
> > 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'.
>
> Which Emacs/Tramp version are you using?
>
> > (add-to-list 'tramp-methods
> > '("gcssh"
> > (tramp-login-program "gcloud compute ssh")
>
> This must be exactly the program name. "gcloud" I guess. "compute" and
> "ssh" must be part of tramp-login-args.
>
> > (tramp-login-args (("%h --project example-project example-project-cli")))
>
> "%h" must be an element of its own. Somethging like
>
> (tramp-login-args (("compute ssh") ("%h") ("--project example-project example-project-cli")))
>
> > (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
> > ("-o" "UserKnownHostsFile=/dev/null")
> > ("-o" "StrictHostKeyChecking=no")))
>
> tramp-gw-args do not exists for years. Likely, you don't need them.
>
> When you have adapted your config, set also tramp-verbose to 6. Run the
> test. If it fails, there will be a Tramp debug buffer, which tells
> more. In case you need help to analyze, show it here.
>
> Best regards, Michael.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Need Help With Emacs Tramp Mode For 'gcloud compute ssh'
2021-08-09 17:04 ` Samuel Banya
@ 2021-08-10 12:55 ` Michael Albinus
0 siblings, 0 replies; 4+ messages in thread
From: Michael Albinus @ 2021-08-10 12:55 UTC (permalink / raw)
To: Samuel Banya; +Cc: help-gnu-emacs
"Samuel Banya" <sbanya@fastmail.com> writes:
> Hello Michael,
Hi Samuel,
> I am currently using the latest Emacs Version 27.2.
Good. Could you apply the proposed changes, and see how it works for you?
Best regards, Michael.
^ 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
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.