3

I am trying to SSH into my Macbook Pro (10.6.8) using my Android phone. It is a SGH-T989 running the latest stable Cyanogenmod 10 (4.1.2).

I have enabled remote login on my Mac and confirmed I can SSH into it using another Macbook Pro (running 10.7.5). However, when I type "ssh user@ip" on my Android terminal, I get the following message after about 4-5 minutes of waiting.

logossh: connect to host xxx.xxx.x.xxx port 22: Connection timed out

Any ideas why it works from another Macbook Pro but not from my Android phone? I also tried using connectbot but I get the same problem.

I never tried using WiFi while on CM10, but I just finished flashing and rooting stock touchwiz 4.1.2 (I missed the camera app and had terrible battery life on CM10). It connects fine when the phone is connected to the same wifi as the macbook pro but when I turn wifi off and use data, connectbot says:

Connection Lost failed to connect to 192.168.1.106 (port 22): connect failed: ENETUNREACH (Network is unreachable)

2
  • Just to check the main things: 1) Are you on the same WiFi network with the Android phone? (if not, do you have port forwarding on your router forwarding to your mac & using the public IP?) 2) Can you ping from android to the mac you are trying to reach?
    – nerdwaller
    Commented Apr 23, 2013 at 0:24
  • THanks for your response, nerwaller. I never tried using wifi while on CM10 but I just finished flashing and rooting stock touchwiz 4.1.2 (I missed the camera app and had terrible battery life on CM10). It connects fine when the phone is connected to the same wifi as the macbook pro but when I turn wifi off and use data, connectbot says: "Connection Lost failed to connect to 192.168.1.106 (port 22): connect failed: ENETUNREACH (Network is unreachable)" Regarding #2, I'm not sure how I would do that.. Commented Apr 23, 2013 at 2:25

1 Answer 1

2

You can't ssh from your phone to your Mac when using mobile data because you are no longer on the same network, and thus can't use the internal (RFC1918) address to reach it.

When you're using WiFi, it works because you are on the same network.

In order to reach your computer when using mobile data on your phone, you must do BOTH of:

  1. ssh to your computer's public IP address; and
  2. Forward port 22 from your home router to the computer you want it to reach.
0

You must log in to answer this question.

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