6

I am trying to use Tramp to log into a server that has no SSH keys, just a password. Unfortunately, upon execution of my /ssh:[email protected]:~/ command, there is no password prompt and the minibuffer says Sending password, and fails to login. How can I get Tramp to prompt me for a password? Or, how can I configure Tramp to log into this server that has no SSH keys and just a password?

I can SSH into the server via terminal just fine with ssh [email protected], where the password prompt is:

[email protected]'s password:

Unless I enter my password, there is no other output in the terminal.


Here is the output in my *Messages* buffer:

Tramp: Opening connection for [email protected] using ssh...
Tramp: Sending command `exec ssh -l root  -e none 111.111.111.111'

Tramp: Waiting for prompts from remote shell
Tramp: Sending password
Tramp: Sending command `exec ssh -l root  -e none 111.111.111.111'
Tramp: Opening connection for [email protected] using ssh...done
Quit

and after setting a verbose output using (setq tramp-verbose 10), here is the output into my *debug tramp/ssh [email protected]* buffer:

http://pastebin.com/UKJnzP66

Note that I get the same results when using emacs -q.

My M-x tramp-version is 2.2.6-24.3, running on Ubuntu 14.04.

Any help would be appreciated, or even a description of the logs. I am confused because Tramp seems to be sending some kind of default password without prompting me, even when run with emacs -q.

Update

I tried setting tramp-password-prompt-regexp with the following:

  (setq
    tramp-password-prompt-regexp
      (concat
        "^.*"
        (regexp-opt
          '("passphrase" "Passphrase"
            ;; English
            "password" "Password"
            ;; Deutsch
            "passwort" "Passwort"
            ;; Français
            "mot de passe" "Mot de passe") t)
        ".*:\0? *"))

which is ^.*\(Mot de passe\|Pass\(?:phrase\|wor[dt]\)\|mot de passe\|pass\(?:phrase\|wor[dt]\)\).*:^@ when evaluated with (message tramp-password-prompt-regexp).

and here is the updated output from *debug tramp/ssh [email protected]*:

(lines 1-44) http://pastebin.com/99w6LbyX (lines 45-88) http://pastebin.com/2LrDYzNk

10
  • 1
    Set verbosity a little higher and then take a look at the logs: (setq tramp-verbose 10)
    – user2005
    Mar 20, 2015 at 10:04
  • I updated my question above. It didn't add much extra output, unfortunately. Thanks for the tip; let me know if I can do more to help.
    – modulitos
    Mar 20, 2015 at 10:23
  • You should also have buffer with a name like *debug tramp* or similar. This should tell you a little more. TRAMP does not write the debug messages to *Messages*.
    – user2005
    Mar 20, 2015 at 11:03
  • @rekado thanks, I updated the *debug tramp* buffer output. I'm still not sure why Tramp doesn't offer a password prompt.
    – modulitos
    Mar 20, 2015 at 11:39
  • be sure to take a look at the manual: gnu.org/software/emacs/manual/html_node/tramp/… It looks like TRAMP fails to find the remote password prompt. Check the value of tramp-password-prompt-regexp and the actual password prompt on the remote.
    – user2005
    Mar 20, 2015 at 12:46

2 Answers 2

3

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

One way to test it: 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 tramps 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
1
  • I understood this could have been the problem by looking at Tramp's code, which attempts to interpret the login prompt in all the languages of the world. No way it can detect a modern prompt, and in fact a fast search led to you. However, to detect SSH, I think it could be better the more specific if [ -n "$SSH_CLIENT" ] ....
    – antonio
    Aug 15, 2022 at 0:30
2

In short, I had an incorrectly configured ~/.authinfo that causes Tramp to automatically send a default password (which was the incorrect password). Deleting ~/.authinfo resolved my issue.

An incorrectly configured ~/.netrc can also cause this same issue. So make sure to check whether a .authinfo or .netrc file exists, and ensure that it is not submitting an incorrect password as the default.

@MichaelAlbinus and the Tramp-dev team helped me resolve this issue. After submitting my verbose log output to the Tramp-dev team, I received this response:

Tramp sends a password, but a wrong one:

> 19:58:17.561007 tramp-send-command (6) # exec ssh -l root  -e none 111.111.111.111
> 19:58:19.457169 tramp-accept-process-output (10) #
> [email protected]'s password:
> 19:58:19.463921 tramp-action-password (3) # Sending password
> 19:58:21.526264 tramp-process-actions (6) #
> [email protected]'s password:
> Received disconnect from 111.111.111.111: 2: Too many authentication failures for root

Deleting my .authinfo file brought back Tramp's password prompt. It was my error for not having Gnus Authinfo properly configured.

Unfortunately my complete logs are too long to attach or pastebin here, but I hope this is enough of a summary to help others out.

Your Answer

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

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