Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dangirsh
Created July 23, 2022 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dangirsh/a3405f31070ce1a7bce4e13b76e3a198 to your computer and use it in GitHub Desktop.
Save dangirsh/a3405f31070ce1a7bce4e13b76e3a198 to your computer and use it in GitHub Desktop.
This wrapper is necessary to workaround the limitations of the =tramp-methods= specifications + the quirks of =tsh ssh=.
#+begin_src sh :tangle /sudo:root@localhost:/usr/local/bin/tsh-tramp-wrapper :tangle-mode (identity #o775)
#!/bin/sh
set -eu
TELEPORT_USER=$1
TELEPORT_NODE=$2
tsh ssh ${TELEPORT_USER}@${TELEPORT_NODE}
#+end_src
#+begin_src sh :tangle /sudo:root@localhost:/usr/local/bin/tsh-scp-tramp-wrapper :tangle-mode (identity #o775)
#!/bin/sh
set -eu
LOCAL_FILE=$1
SPEC=$2
tsh scp ${LOCAL_FILE} ${SPEC}
#+end_src
#+begin_src emacs-lisp :results verbatim
(defun teleport-tramp-add-method ()
"Add teleport tramp method."
(add-to-list 'tramp-methods `("tsh"
(tramp-login-program "tsh-tramp-wrapper")
(tramp-login-args
(("%u")
("%h")))
(tramp-copy-program "tsh-scp-tramp-wrapper")
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-i" "-c")))))
;;;###autoload
(eval-after-load 'tramp
'(progn
(teleport-tramp-add-method)))
#+end_src
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment