From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Ricardo Wurmus Newsgroups: gmane.emacs.help Subject: aborting TRAMP / SSH passphrase prompt Date: Thu, 23 Mar 2017 06:44:52 +0100 Message-ID: <87shm4sg17.fsf@elephly.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1490277580 478 195.159.176.226 (23 Mar 2017 13:59:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 23 Mar 2017 13:59:40 +0000 (UTC) User-Agent: mu4e 0.9.18; emacs 25.1.1 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Mar 23 14:59:36 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cr3Gz-0007g1-OJ for geh-help-gnu-emacs@m.gmane.org; Thu, 23 Mar 2017 14:59:29 +0100 Original-Received: from localhost ([::1]:56638 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cr3H5-0004DY-S1 for geh-help-gnu-emacs@m.gmane.org; Thu, 23 Mar 2017 09:59:35 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqvYY-0006Ap-Cy for help-gnu-emacs@gnu.org; Thu, 23 Mar 2017 01:45:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqvYT-0005uV-Fq for help-gnu-emacs@gnu.org; Thu, 23 Mar 2017 01:45:06 -0400 Original-Received: from sender-of-o51.zoho.com ([135.84.80.216]:21044) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqvYT-0005u5-8p for help-gnu-emacs@gnu.org; Thu, 23 Mar 2017 01:45:01 -0400 Original-Received: from localhost (x4d021a69.dyn.telefonica.de [77.2.26.105]) by mx.zohomail.com with SMTPS id 1490247895789337.8618837350424; Wed, 22 Mar 2017 22:44:55 -0700 (PDT) X-URL: https://elephly.net X-PGP-Key: https://elephly.net/rekado.pubkey X-PGP-Fingerprint: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 135.84.80.216 X-Mailman-Approved-At: Thu, 23 Mar 2017 09:59:03 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:112636 Archived-At: 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: /ssh:me@example.com#1022|root@example.com:/etc/foo.conf (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 (list ;; 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 example.com 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. -- Ricardo GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC https://elephly.net PS: Please keep me in Cc as I’m not subscribed to this list.