0

I would like to use tramp to login to a remote server via SSH.

It used to work effortlessly, but somehow it does not even ask me for a password any longer and tries wildly to login with I guess keys from ~/.ssh or something, until the server gives me:

Received disconnect from MYSERVER port 22:2: Too many authentication failures

How do I force tramp to not try anything, but always use password authentication? I also do not wish to use an authentication file currently. I have found many questions where an authentication file was the chosen solution, but I would like to stick with Emacs asking me for a password for now. I am looking for the tramp equivalent of:

ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no MYUSER@MYSERVER

I already have the following in my init.el:

;; ==========
;; TRAMP MODE
;; ==========
(setq tramp-default-method "ssh")
(setq tramp-verbose 5)
(setq password-cache-expiry 86400)
(setq auth-source-debug t)
(setq auth-sources '())

I also have a hunch, that it might be, that tramp does not notice, that the server asks for a password, because of a custom MOTD, but am not sure, that this is the issue. The MOTD looks like this:

#####################################
#####################################
#                                   #
#      LOGGING IN TO MYSERVER       #
#                                   #
#####################################
#####################################
MYUSER@MYSERVER's password: 

Versions

  • tramp: tramp 2.2.13.25.2 built-in
  • emacs: GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21) of 2017-09-22, modified by Debian

Output in debug tramp/ssh

#####################################
#####################################
#                                   #
#      LOGGING IN TO MYSERVER       #
#                                   #
#####################################
#####################################
Received disconnect from MYSERVERIP port MYSERVERPORT:2: Too many authentication failures
Disconnected from MYSERVERIP port MYSERVERPORT
23:31:27.476717 tramp-maybe-open-connection (3) # Opening connection for MYSERVERUSER@MYSERVERIP using ssh...failed
23:41:32.631334 tramp-get-test-command (5) # Finding a suitable ‘test’ command
23:41:32.632857 tramp-maybe-open-connection (3) # Opening connection for MYSERVERUSER@MYSERVERIP using ssh...
23:41:32.641165 tramp-maybe-open-connection (3) # Sending command ‘exec ssh -l MYSERVERUSER  -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none MYSERVERIP’
23:41:32.643068 tramp-process-actions (3) # Waiting for prompts from remote shell...
23:41:33.474487 tramp-process-one-action (5) # Looking for regexp "\(.*\(user\|login\)\( .*\)?: *\)\'" from remote shell
23:41:33.477166 tramp-process-one-action (5) # Looking for regexp "\(^.*\(\(?:adgangskode\|contrase\(?:\(?:ny\|ñ\)a\)\|geslo\|h\(?:\(?:asł\|esl\)o\)\|iphasiwedi\|jelszó\|l\(?:ozinka\|ösenord\)\|m\(?:ot de passe\|ật khẩu\)\|pa\(?:rola\|s\(?:ahitza\|s\(?: phrase\|code\|ord\|phrase\|wor[dt]\)\|vorto\)\)\|s\(?:alasana\|enha\|laptažodis\)\|wachtwoord\|лозинка\|пароль\|ססמה\|كلمة السر\|गुप्तशब्द\|शब्दकूट\|গুপ্তশব্দ\|পাসওয়ার্ড\|ਪਾਸਵਰਡ\|પાસવર્ડ\|ପ୍ରବେଶ ସଙ୍କେତ\|கடவுச்சொல்\|సంకేతపదము\|ಗುಪ್ತಪದ\|അടയാളവാക്ക്\|රහස්පදය\|ពាក្យសម្ងាត់\|パスワード\|密[码碼]\|암호\)\).*:

It seems to me that the "sending command" part: Sending command ‘exec ssh -l MYSERVERUSER -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none MYSERVERIP’ is wrong, or at least not what I want.

1 Answer 1

1

You haven't said which Tramp version you are using. However, recent Tramp versions use the auth-source package for getting the password from an authentication file. In order to disable this, just eval (setq auth-sources nil).

3
  • I added version information in the question. Setting to nil instead of '() (I was too much in my Scheme mind set.) did unfortunately not change anything. I still get the "too many authentication failures" message without a chance to enter a password. Commented Feb 4, 2019 at 22:40
  • Well, your MOTD could be interpreted by Tramp as shell prompt. Just a wild guess. I recommend to adapt tramp-shell-prompt-pattern and shell-prompt-pattern. If this doesn't help, pls write a bug report; analysis of the trace files is out of scope of stackexchange. Commented Feb 5, 2019 at 7:36
  • I think that is some regex I need adapt. If I find a solution, I will add it here. Thanks! Commented Feb 5, 2019 at 9:21

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.