0

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.

volare
  • 11
  • 3
  • `10.0.0.231:2222` is not a valid destination. Use either `ssh -p 2222 [email protected]` or `ssh ssh://[email protected]:2222`. What do you mean by "I can ssh when it resolves through https hostnames"? – tastytea Mar 24 '19 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 '19 at 14:26
  • Would you update your question with the output of `ssh -v server`, please? – tastytea Mar 24 '19 at 14:35
  • 1
    I meant `ssh -v `, not the string "server". – tastytea Mar 24 '19 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 '19 at 15:13
  • That won't be necessary. Have you tried deactivating the firewall? Are you sure the ssh server listens on the right IP and port? (you can check with `sudo netstat -tlpn | grep sshd`) – tastytea Mar 24 '19 at 15:21
  • ive been trying to connect to brand new droplets on digital ocean. There shouldn't be a firewall or anything at all right? – volare Mar 24 '19 at 15:27
  • something happens when i use an ipv6 address – volare Mar 24 '19 at 15:56

2 Answers2

0

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 [email protected]

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 10.0.0.231:2222 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
    HostName 10.0.0.231
    Port 2222

and then use

ssh thehost
Kusalananda
  • 320,670
  • 36
  • 633
  • 936
  • 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 '19 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 '19 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 '19 at 14:38
0

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?

volare
  • 11
  • 3