When a Tramp session over SSH has been inactive for some time, it fails to wake up again and just hangs Emacs. How can I ensure that Tramp will either renew the connection, or time out before too long?

The hang is evident from the minibuffer message:

Decoding remote file ‘/ssh:foohost:/home/bignose/barfile.txt’ using ‘base64 -d -i >%s’

and an animated spinner, that spins endlessly for tens of minutes without result.

During this, Emacs is hung: it doesn't respond to any commands or keys, not even keyboard-quit (C-g).

This is Emacs version 25.2.

How can I convince Emacs that Tramp sessions should be re-established when they time out, instead of waiting forever?


2 Answers 2


After the tramp-cleanup-all-connections command, you can just continue and a new session will be established on any further tramp action.


Abort with C-g, then kill the tramp buffers :

Open the buffer list with C-x C-b, locate anything tramp and mark them for deletion (d) then execute (x) you can now use Tramp again.

  • “Abort with C-g […]” — as noted in the question, Emacs is unresponsive (including C-g) while it is waiting for the SSH command to run.
    – bignose
    Commented Jul 17, 2017 at 7:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.