Re: ssh issue that I don't understand

Greg Wooledge <[email protected]> Mon, 6 Jul 2026 07:03:24 -0400
Newsgroups gmane.linux.debian.user
Message-ID <[email protected]>
On Mon, Jul 06, 2026 at 15:25:55 +0500, Alexander V. Makartsev wrote:
> On 7/6/26 12:50, Chris Green wrote:
> > Alexander V. Makartsev<[email protected]> wrote:
> > > The host entry in your case should look like this:
> > > 
> > > Host isbd.biz
> > >     HostName isbd.biz
> > >     Port 22
> > >     User chris
> > >     IdentityFile ~/.ssh/my-ssh-key-for-isbd-biz.key
> > > 
> > But that's all default settings. Sites work without entries in
> > ~/.ssh/config if the configuration is as you've shown above.

The IdentityFile line there is not a default setting.

> SSH client uses password authentication by default, so if you want to
> authenticate with private key then you need to explicitly setup
> "IdentityFile" directive or use "-i" command line parameter to select a key
> file.

This is incorrect.  ssh will use key authentication by default, but
only if your key has one of the default filenames.

Obviously ~/.ssh/my-ssh-key-for-isbd-biz.key is not a default filename
that ssh will look for.

In Trixie's ssh(1) (10.0p1):

       -i identity_file
               Selects a file from which the identity (private key) for  public
               key  authentication  is read.  You can also specify a public key
               file to use the corresponding private  key  that  is  loaded  in
               ssh-agent(1)  when  the private key file is not present locally.
               The     default     is      ~/.ssh/id_rsa,      ~/.ssh/id_ecdsa,
               ~/.ssh/id_ecdsa_sk,  ~/.ssh/id_ed25519 and ~/.ssh/id_ed25519_sk.
               Identity files may also be specified on a per-host basis in  the
               configuration  file.

If your key is in one of those filenames, then you don't need to specify
it with a -i option.  ssh will simply try to use it.  (The list of
filenames changes from time to time, so consult your own ssh(1) to be sure
of which ones are being used.)