tramp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

2 tramp problems


From: Alex V. Koval
Subject: 2 tramp problems
Date: Sat, 03 Nov 2018 11:27:12 +0200

Hi Michael,

I am happy to write to you again, and for a start I would like to tell
you big BIG THANK YOU! For providing this excellent tramp module which I and
thousands of emacs users are using worldwide! I am software developer
and DevOps and this exact feature makes my life so much better!

Nice to meet you again, btw I have seen your youtube videos, it was nice
to see you in live mode in video :-)
https://www.youtube.com/watch?v=qu97wa8YTrU&t=1697s

Both my problems are not urgent, but it makese sense to fix them earlier
or later. OK, so switching to actual problems:

One problem is this (easy to reproduce)
---------------------------------------

1. As example I am taking remote server 'hosting' where 2 facts are
true:
 - I have address@hidden account
 - There is *no* ubuntu@ account on that host

2. Assume I forget that I have to login to root@ directly, and trying to
do it via 'ubuntu' account first:

 Trying to open:
 /ssh:address@hidden|sudo:address@hidden:

 leads to:

 Tramp: Opening connection for address@hidden using sudo...
 Tramp: Sending command ‘exec ssh -l ubuntu   -e none hosting’
 Tramp: Waiting for prompts from remote shell...
 Tramp: Sending password

3. Now, I see this prompt for password, I realize that I should be
   logging there directly. I try to do it, now directly:

   /ssh:address@hidden:
   Tramp: Waiting for prompts from remote shell...
   Tramp: Sending password
   Tramp: Waiting for prompts from remote shell...failed
   Tramp: Opening connection for address@hidden using ssh...failed

   .. so the problem is that despite the fact that now I am specifying
   /ssh:address@hidden: directly, it still tries to invoke ssh:ubuntu@
   first.

   tramp-cleanup-all-connections does not help.

2nd problem
-----------

I have 2nd problem, and I am not sure if this is reflection 1st or
something else. Sometimes, I can have several paths to connect to remote
host. For example:

This paths allows me to use custom defined 'docker' tramp method
which I use to connect to docker container in privileged mode on hosting
server:

/ssh:address@hidden|docker:some.site.name:

But then, I might connect to the same site using direct 'ssh' when
container has ssh access:

/ssh:address@hidden:some.site.name#port:

I am not sure if different #port here is causing this but it still tries
to connect to previous host using root ->docker path. Again, this does
not help:

M-x tramp-cleanup-all-buffers
M-x tramp-cleanup-all-connections

and so in such case I have to restart emacs completely to get to host
correctly.

Would be great if you advice me what to do or find out how to fix those
issues.

JFYI as a DevOps I find it very useful to be able to connect into
Docker, Openshift and Kubernetes containers with a great tool which
Emacs is (not only editor, but org-mode and other things makes it easy
to execute/filter results etc). Here are my custom connectors (up to you
may me makes sense to include some of them into official support):

;; Problem with su: often many system accounts are hidden under /sbin/nologin 
due to reasons explained here:
;; 
https://unix.stackexchange.com/questions/155139/does-usr-sbin-nologin-as-a-login-shell-serve-a-security-purpose
;; ... as result 'su' won't work, but with lisp it is easy to define 'sush' 
which will do -s /bin/sh
(push
 (cons
  "sush"
  '((tramp-login-program "su")
  (tramp-login-args (("-") ("%u") ("-s" "/bin/sh")))
  (tramp-remote-shell "/bin/sh")
  (tramp-remote-shell-login
   ("-l"))
  (tramp-remote-shell-args
   ("-c"))
  (tramp-connection-timeout 10)))
 tramp-methods)
;;

;; from 
https://emacs.stackexchange.com/questions/17543/tramp-mode-is-much-slower-than-using-terminal-to-ssh
(setq remote-file-name-inhibit-cache nil)
(setq vc-ignore-dir-regexp
      (format "%s\\|%s"
                    vc-ignore-dir-regexp
                    tramp-file-name-regexp))
(setq tramp-verbose 1)


(push
 (cons
  "ocrsh"
  '((tramp-login-program "oc")
    (tramp-login-args (("rsh") ("%h") ("/bin/sh")))
    (tramp-remote-shell "/bin/sh")
    (tramp-remote-shell-args ("-i"))))
 tramp-methods)

(push
 (cons
  "kube"
  '((tramp-login-program "kubectl")
    (tramp-login-args (("exec") ("%h") ("-it") ("/bin/sh")))
    (tramp-remote-shell "/bin/sh")
    (tramp-remote-shell-args ("-i"))))
 tramp-methods)

WBR, and again thank you! 
Alex V Koval

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]