Created
July 23, 2022 16:25
-
-
Save dangirsh/a3405f31070ce1a7bce4e13b76e3a198 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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