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
      CommentedOct 11, 2021 at 19:24
    • Copy the whole configuration, and the second time use Host 25.10.25.10 instead.CommentedOct 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
      CommentedOct 11, 2021 at 19:35
    • or just ssh [email protected]CommentedOct 11, 2021 at 19:38
    • @Kenster, thanks, that worked!
      – Dave
      CommentedOct 13, 2021 at 16:21

    You must log in to answer this question.

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.