-1

I'm trying to SSH into an Ubuntu computer from my MacOSX computer. I have openssh installed on my Ubuntu and have disabled the firewall. I've ssh-ed into other servers before on this Macbook. I don't get a response from the Ubuntu server though:

$ ssh -v <domain_name>
OpenSSH_7.8p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to <domain_name> port 22.
ssh: connect to host <domain_name> port 22: Operation timed out

I've already tried pinging the domain name, that works. I ran 'ssh localhost' on the Ubuntu computer and it worked fine. I also checked that port 22 was listening and is ssh, it is. I tried using 'ssh username@domain_name'. Same response. Any ideas?

Hackerman
  • 1,289
  • 1
  • 14
  • 29
  • Do your home computer inside a **subnet** under domain_name or it is directly domain_name? – Geno Chen Dec 15 '18 at 03:37
  • I'm not sure how to check...it's a regular ubuntu computer with a user account (username and password). – Hackerman Dec 15 '18 at 03:40
  • 1
    On your Ubuntu computer, `$ ifconfig` and check whether there is an IP shown as the inet4 / inet6 address the same as the IP of domain_name (no subnet), or the IP is 192.168.* (have subnet, needs port forwarding). – Geno Chen Dec 15 '18 at 03:43
  • 1
    First thing first, find out the IP address of the Ubuntu. Type ifconfig and get the IP from the terminal and then move on to Mac and try to ping the Ip address of Ubuntu. – nPcomp Dec 15 '18 at 03:44
  • I did that already nPcomp. I can ping it fine – Hackerman Dec 15 '18 at 03:45
  • @GenoChen its 192.168.* I'll look into port forwarding... – Hackerman Dec 15 '18 at 03:48
  • @nPcomp ping can't be used to indicate this question, for example if that target is behind a router, you can ping it (receiver is the router but you don't know that), but you can't ssh it. – Geno Chen Dec 15 '18 at 03:48
  • @GenoChen Yes you are right but if you do not have any network connection you will not be able to ssh into the machine either. – nPcomp Dec 15 '18 at 03:51
  • thank you both! @GenoChen you were right I needed port forwarding! Can you make an answer so I can accept it? – Hackerman Dec 15 '18 at 03:52
  • @nPcomp but the the device can be configured for disallowing pinging. – Geno Chen Dec 15 '18 at 03:53
  • 1
    @Hackerman On windows psping and on Mac, nmap is good options to check if you can access to port 22 from your machine. – nPcomp Dec 15 '18 at 03:55
  • @nPcomp Oh yes, I forgot that, nmap can be used to check this. – Geno Chen Dec 15 '18 at 03:58

1 Answers1

1

As the asker's comment pointed out, the IP of the target computer is a subnet IP, which indicates that this target is behind some devices, for example a router or something equivalent.

Then, pinging to the domain_name, from out of the router, will be targeted to that router, but you may not know this.

To solve this issue, just configure a port forwarding at the router, "when receiving data from <outer port>, forward it to <inner ip>:<inner port>", then the ssh request will be forwarded to the expected destination.

Geno Chen
  • 4,916
  • 6
  • 21
  • 39