[Top][All Lists]

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

aborting TRAMP / SSH passphrase prompt

From: Ricardo Wurmus
Subject: aborting TRAMP / SSH passphrase prompt
Date: Thu, 23 Mar 2017 06:44:52 +0100
User-agent: mu4e 0.9.18; emacs 25.1.1

Hi list,

I regularly encounter problems with TRAMP when trying to connect to a
server for the first time.  That alone is not the issue.  It is usually
easy to diagnose what went wrong and adjust the configuration.  What
bothers me, however, is that very often I end up in a state that I
cannot easily back out of, which results in a broken Emacs session.

The problem I had just now was that I was stuck in an unabortable
password prompt loop.

I tried to access a file on a remote server using a file name like this:


(In my ~/.ssh/config that server has a section in which I specified the
port as 1022, and where I specified the identity file to be used, so
actually, this ad-hoc configuration in the file path should not have
been necessary.)

My TRAMP configuration looks like this:

--8<---------------cut here---------------start------------->8---
(require 'tramp)
(setq tramp-default-method "ssh")

(setq tramp-default-proxies-alist
       ;; Do not use a proxy on the same system.
       '((regexp-quote (system-name)) nil nil)
       ;; For root connections to remote hosts, log in via ssh with normal
       ;; user account first, then su/sudo to root
       '("example\\.com\\'" "\\`root\\'" "/ssh:%h:")
       ;; more servers…
;; respect the PATH variable on the remote machine
(add-to-list 'tramp-remote-path 'tramp-own-remote-path)
(setq tramp-verbose 3)
--8<---------------cut here---------------end--------------->8---

I also disabled auto-save for remote files:

--8<---------------cut here---------------start------------->8---
(setq backup-directory-alist
      `(;; Do not backup or auto-save remote files to prevent delays.
        (,tramp-file-name-regexp . nil)
        ;; Write backup files to a dedicated directory.
        ("." . ,(expand-file-name
                 (concat user-emacs-directory "backups")))))
--8<---------------cut here---------------end--------------->8---

When I hit return to access the remote file I was given a passphrase
prompt.  I entered the correct passphrase to unlock my SSH key, but was
denied access.  So I decided to abort the passphrase prompt with C-g.

The prompt disappeared for a fraction of a second, but then reappeared.
I tried aborting again only to be presented with the prompt yet again.
I continued my attempts to abort and used ESC-ESC-ESC, which moved focus
away from the minibuffer.  The prompt reappeared but this time was not
focused and changing focus back to the minibuffer didn’t quite work.

It didn’t help that Emacs got into a state where it would show the
prompt but not accept *any* input (not even C-g).  This went on for
another 20 minutes until I remembered a workaround: kill the SSH
connection from outside.  So I looked for the SSH process spawned by
Emacs and found it:

    ssh -p 1022 -o ControlMaster=auto -o ControlPath=tramp.%C -o 
ControlPersist=no -e none

Right after killing it, Emacs became usable again.  (Although even that
sometimes is not enough, if I remember correctly.)

I’m using Emacs 25.1.1 on a GNU system.

How can something like this be avoided in the future?  (Am I just
holding it wrong?)  Should I report this as a bug?  It’s hard to
reproduce this *exactly*, because each time it’s not clear to me how
*exactly* I got into this mess.

Any advice would be very welcome!  I really like TRAMP and would like to
avoid the frustration of seeing it fail in this way.


GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC

PS: Please keep me in Cc as I’m not subscribed to this list.

reply via email to

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