0

Given the following ~/.ssh/config file, why do I get a Permission denied (publickey) when executing

$ ssh entel.rancher1.internal

When this works:

$ ssh -i ~/.ssh/id_rsa [email protected]

~/.ssh/config

Host *
  IdentityFile ~/.ssh/id_rsa

Host entel.rancher1.internal
  HostName 172.0.0.4
  User devops
  IdentityFile ~/.ssh/id_rsa

I've already validated that the permissions are correct:

$ ls -al ~/.ssh
drwx------ dj dj .
-rw------- dj dj config
-rw------- dj dj id_rsa

Question: Why can I not connect to my machine via the ~/.ssh/config file by typing in the HostName, while I can SSH in using my private key with a bare ssh command?

1 Answer 1

0

My guess is that you are having an issue with the username. I think it is trying to log in as [email protected]

I suspect that the following would work:

ssh [email protected]

Edited to remove information that was incorrect based on a typo in manpages

8
  • the command does work, yes.. but I had specified User devops. why would the config be ignoring this?
    – ddavison
    Apr 9, 2018 at 20:09
  • See edit above. Apr 9, 2018 at 20:11
  • i've used SSH for years and have never seen this. Pretty sure that User' is a typo, as you get a "bad configuration" in the config if you arbitrarily put that character in :) any example out there has just User theuser
    – ddavison
    Apr 9, 2018 at 20:13
  • I just did "man ssh_config" on my machine and I can confirm that you are correct on that count. Apr 9, 2018 at 20:23
  • I tested this with my own ~/.ssh/config and I found that your configuration works (with my own user and IP substituted in) but with permissions of rw-rw-r-- Apr 9, 2018 at 20:23

You must log in to answer this question.

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