8

I'm running SSHDroid on my unrooted android device. When my SSH client on ubuntu or windows are on same wifi network as the Android, I'm able to connect to it via SSH.

But what I want to do is, connect to the device via SSH from a client like putty etc. from a computer which is not in the same network.

eg. If i'm on the same wifi network, I can connect via SSH using command

$ ssh root@192.168.1.3 -p 2222

but when I connect via ssh using external IP, it says connection refused.

$ ssh root@112.79.41.234 -p 2222

I also tried using PortForward to forward external port to the internal one. But it doesn't seem to work. Can anyone tell me how to do it without rooting the device.?

1

4 Answers 4

2

Quick answer:

You don't need to 'root' your Android phone - both it and SSH are working correctly.


How to solve problem:

You need to better understand 'port forwarding' and 'public IP addresses'.

The 'port-forwarding' needs to occur where the public network ('Internet') meets the private network (WiFi network with Android device). This is usually a 'router', but could be a larger 'firewall'.

You need to find out and add this detail, if you want any further help ..

0

While port forwarding will work, I don't suggest it.

It's tied to very firm constraints:

  • Abandon DHCP and use a static IP in every network you want to work
  • Set up port forwarding rules on every router
  • Set up dynamic DNS for every network
  • Know in which network your Android is

Better have your phone connect to the same virtual private network (VPN) and access it through this. Or use GTalkSMS for an easier setup.

0

IP address conflict can be turned out, at first check that address conflict was or was not the problem.

For this, please have a look

Regarding your network, check /var/log/messages for ethernet link up/downs (or wlan in case of wireless). If so try changing the cables.

It's not a simple connectivity issue. The ethernet link does not change state; server is reachable via ping; ssh connects flawlessly occasionally, then seemingly randomly does not connect or existing ssh session drops.

  • Change adapter from DHCP to static.
  • Try ssh -v ip and check the output
1
  • The computer having ssh client is behind the router at my workplace and the android device is using 3G internet. No ethernet here..
    – kushdilip
    Nov 2, 2012 at 11:41
0

You could set up a dynamic DNS updater. This will allow you to access your Android device using the same internet IP address no matter where you are. You will need an account with a dynamic DNS provider [1] and an Android SSH server that includes/supports a DNS update tool [2].

You will then be assigned a fixed IP address by the dynamic DNS provider, which you can use wherever you roam. Network limitations (technical or imposed) may still prevent you from access your device in some circumstances.

[1] For example, DNS-o-matic. There are quite a few free providers.

[2] SSH Server by Ice Cold Apps explicitly offers support for dynamic DNS. Nothing is mentioned on the SSHDroid page, but you could query them.

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