Emacs: Tramp doesn't work

jerboa picture jerboa · Aug 5, 2011 · Viewed 19.6k times · Source

I tried to open a remote file via Emacs via Tramp.

(require 'tramp)
(setq tramp-default-method "ssh")

I get a message from Emacs

Tramp: Waiting for prompts from remote shell

Emacs hung and did not respond to any action after that

Emacs was installed on Windows; the remote file was on a Linux machine.

Answer

yPhil picture yPhil · Dec 2, 2011

If the account you're connecting to uses some weird fancy shell prompt, then there is a good chance that this is what makes tramp trip.

Log in as root, then enter

PS1="> "

(that's a normal, standard shell (ZSH, BASH, younameit) prompt, one that tramp will understand) then switch to the user account, and launch emacs -q (to make sure that your .emacs is not causing this mess) and try to C-x C-f /sudo:root@localhost:/etc/hosts and see what's what.

You can (not recommended) also customize the regexp that defines what tramp expects :

M-x customize-variable RET tramp-terminal-prompt-regexp

My approach :

  1. Make sure the variable tramp-terminal-type is set to "dumb"

M-x customize-variable RET tramp-terminal-type

  1. Test that in your .*shrc and serve the correct prompt :
case "$TERM" in
"dumb")
    PS1="> "
    ;;
xterm*|rxvt*|eterm*|screen*)
    PS1="my fancy multi-line \n prompt > "
    ;;
*)
    PS1="> "
    ;;
esac