Update: I found this question which seems to be very related. Not sure how exactly.

What am I missing? I can only use ssh when it resolves through https hostnames? Normal ssh it hangs kinda like encryption keys aren't working, but I am using keys that I know have worked in the past.

ssh -v server

OpenSSH_7.9p1, OpenSSL 1.1.1b  26 Feb 2019
debug1: Reading configuration data /home/user/.ssh/config
debug1: /home/user/.ssh/config line 39: Applying options for server
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to x.x.x.x [x.x.x.x] port 22.

my config

Host server
User user
HostName x.x.x.x
IdentityFile ~/.ssh/id_key  

I don't recall ever changing my /etc/ssh/ssh_config and my firewall is set to allow ssh.

  • is not a valid destination. Use either ssh -p 2222 j@ or ssh ssh://j@ What do you mean by "I can ssh when it resolves through https hostnames"? – tastytea Mar 24 at 14:17
  • oh yeah i thought I took that out, thats just aspecific port for that box.....I have servers with ssl certificates specific ssh-keys and I can ssh to their hostnames – volare Mar 24 at 14:26
  • Would you update your question with the output of ssh -v server, please? – tastytea Mar 24 at 14:35
  • 1
    I meant ssh -v <IP/hostname of your server>, not the string "server". – tastytea Mar 24 at 14:48
  • I updated the question with info from the bad connection, it hangs after it reads the configuration file. do you want output from the working connection? how much should I post? – volare Mar 24 at 15:13

If you want to connect to a particular port on the remote system with ssh, you should be using the -p option:

ssh -p 2222 j@

When the target address does not look like an IP number, which it does not do if you add :2222 to the end of it, ssh will try to resolve the whole string as a hostname using DNS.

If you find yourself connecting to this host on this port often, you may want to set up a configuration for it to make it easier. Edit (or create) your ~/.ssh/config file and add

Host thehost
    User j
    Port 2222

and then use

ssh thehost
  • Sorry that part is irrelevant. I thought I erased it. I've been able to access that in the past without issue and it isn't really the problem im tryin to solve. – volare Mar 24 at 14:29
  • @JacobBruck The ssh client may say "connection timed out" when you use it with an IP address, but it would not say "could not resolve hostname" since you're not giving it a hostname. Could you please re-run your test and insert the proper error message in the question? – Kusalananda Mar 24 at 14:32
  • Yep I'm looking back at what is going on here. That solution does work, which tells me my test was flawed from the start..so I'm back to square one.. – volare Mar 24 at 14:38

This isn't the full answer, but my encryption keys work with ipv6.

so two possibble answers. I'm dumb and got ssh keys mixed up a billion times a long with my ip addresses, (very likely), but I still can't connect when I try an ipv4 address with encryption keys

So I did something to make ssh only allow encryption keys with ipv6? I don't know if that is even a thing, or how or why. And why would ipv4 work without encryption?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.