1

I have a list of hosts 192...* with a default user and password, I've tried to set wild-card in .authinfo.gpg but it still requests password when I try to login.

There are no problems when it set per host IP.

3 Answers 3

0

AFAIK, the auth-source package does not support host wildcards. Tramp is using this package for password handling.

3
  • So, can I populate .authinfo.gpg with range or network? 192.168.1.1/24 as an example?
    – Hellseher
    Aug 30, 2018 at 20:00
  • 1
    I'm not aware of such a feature, see the auth-source manual (info "(auth)"). Maybe you write a wishlist request via the Emacs Bug Tracker. Aug 31, 2018 at 7:39
  • 1
    What about just using ssh keys and adding the key to the hosts you want to login with. With modern key rings and ssh agent, you won't need to enter passwords apart from the initial ssh-agent one
    – Tim X
    Jul 10, 2019 at 12:21
0

You cannot do this in TRAMP, as has already been pointed out, but you can partly do this in your SSH config. (I merely assume that you are using SSH, because what other options are there? Hopefully you are not using telnet.)

You should read the ssh_config man page for the details, but you can put something like this in your ~/.ssh/config file:

Host 192.168.0.?
User hellseher
IdentityFile ~/.ssh/filename

You cannot set a password this way, but you can specify which key pair to use using the IdentityFile declaration. This lets you log in without a password.

0

At pointed out by @michael-albinus, auth-source does not support explicit host wildcards. It does however support fallback matching, so a .authinfo.gpg containing

machine foo login bar password pass-bar

login baz password pass-baz

will return "bar/pass-bar" for host "foo" and "baz/pass-baz" for every other host.

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.