I have an issue with tramp against a specific host when I use ssh-keys for authentication. It works fine when I don't use ssh-key authentication, but I would like to prevent entering the password all the time.

Don't know if it's related, but I use zsh for shell.

I have followed both the tips of setting tramp-chunksize to 500 and adding the following code to .zshrc:

if [[ "$TERM" == "dumb" ]]
  unsetopt zle
  unsetopt prompt_cr
  unsetopt prompt_subst
  unfunction precmd
  unfunction preexec
  PS1='$ '

But it's not working and it's still hanging with the message Tramp: Waiting for prompts from remote shell

Any ideas on how to prevent this annoying issue? Thanks.

  • You should mention your operating system and version of Emacs, just in case. And how you normally enter your ssh key passphare, if any, is likely relevant. – Gilles 'SO- stop being evil' Aug 23 '10 at 21:48
  • Well your approach worked for me, anyway... – Bill Burdick Sep 22 at 7:38

For me Tramp 2.1.19-pre with zsh and SSH kye authentication works using

(setq tramp-shell-prompt-pattern "^[^$>\n]*[#$%>] *\\(\[[0-9;]*[a-zA-Z] *\\)*")

in my ~/.emacs


I don't see how your remote shell could be the problem if tramp works with password authentication but not with key authentication.

A possible explanation is that ssh doesn't see your ssh agent when you run it from within Emacs. Can you log in to the remote machine using your key with ssh from a M-x shell or M-x term buffer? If your key has a passphrase, ssh needs to obtain the decrypted key somehow. It can prompt you directly (but I'm not sure if tramp would let the key prompt through), or it can launch an external program to prompt you for the key (this requires the environment variable SSH_ASKPASS to be set), or it can get the key from your ssh agent (this requires the environment variable SSH_AUTH_SOCK to be set). Your problem may be that you're not setting SSH_ASKPASS or SSH_AUTH_SOCK in the right place, so that it's not defined in your Emacs session.

  • It works with both M-x shell and M-x term. Tramp logs the command 'ssh <hostname> -l <username> -q -e none && exit || exit' (which also works fine with M-x shell or M-x term). – grm Aug 24 '10 at 6:30

The question has been answered but for people stumbling upon this, remember to check if your shell may ask for any user input before presenting the shell. For example oh-my-zsh checks for updates and asks for confirmation before installing them at shell startup. This will cause tramp to endlessly wait for a prompt, so make sure that login goes smoothly when you ssh before going down the tramp rabbithole.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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