0

I’m using bash shell and attempting to login to an Ubuntu box

Host remote.web.domain
  Hostname 25.10.25.10
  User remote user
  IdentityFile ~/.ssh/id_rsa
  ForwardAgent yes
  IdentitiesOnly yes

When I try and SSH to the machine using an IP address, I get this error

$ ssh 25.10.25.10
[email protected]: Permission denied (publickey).

But oddly if I SSH using the domain name, I’m able to get in just fine

$ ssh remote.web.domain
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-149-generic x86_64)

What do I need to do, either server or client side, to allow SSH login using the IP address?

1 Answer 1

4

On the config file, Host remote.web.domain indicates that the following lines only applies to remote.web.domain (probably not 25.10.25.10), then key parameters are different : myusername in the first attempt, and user in the second.

5
  • Thanks. How do I change/configure things so that I can ssh using the IP address?
    – Dave
    Commented Oct 11, 2021 at 19:24
  • Copy the whole configuration, and the second time use Host 25.10.25.10 instead. Commented Oct 11, 2021 at 19:30
  • 1
    You can use a single Host block listing both the IP and the hostname: Host remote.web.domain 25.10.25.10...
    – Kenster
    Commented Oct 11, 2021 at 19:35
  • or just ssh [email protected] Commented Oct 11, 2021 at 19:38
  • @Kenster, thanks, that worked!
    – Dave
    Commented Oct 13, 2021 at 16:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .