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.
AFAIK, the auth-source
package does not support host wildcards. Tramp is using this package for password handling.
.authinfo.gpg
with range or network? 192.168.1.1/24 as an example?
Commented
Aug 30, 2018 at 20:00
(info "(auth)")
. Maybe you write a wishlist request via the Emacs Bug Tracker.
Commented
Aug 31, 2018 at 7:39
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.
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.