5

Is it possible to connect a rooted Android device to a RPI via USB and then SSH into the RPI from the Android device over the USB connection? If so is there any documents or tutorials out there that outline this? I've done it from wireless several times but I would like to achieve the SSH connection over the USB cable.

11

You could do that, using android's USB tethering. On android 4 this option should be at settings>more>Tethering and portable hotspot>USB tethering (option becomes enabled when you plug the USB to the PI).

Then you need to set up your PI for this:

1) add the following to /etc/network/interfaces:

auto eth0
iface eth0 inet dhcp
iface usb0 inet dchp

2) and execute the following command:

ifup usb0

Confirm your connection is up via ifconfig

Original guide information was taken from here

  • Thanks for the info! I will try this out over the weekend and get back to ya. I want to be able to use my RPI on the fly and keep wireless available to my RPI for other purposes. Thanks! – 0xhughes Jun 7 '13 at 13:03
  • Sorry for the extreme delay! I was succesfully able to implement this! It was really slick, been using it for months! – 0xhughes Dec 31 '13 at 22:20
1

Not all the Android devices support USB tethering. If it's available on you device, go for it. Otherwise, you can use an ADB client installed on the Raspberry PI, then using some port forwarding you can make the Android tablet and the Raspberry Pi talk on USB.

0

Most likely it's impossible. You'll need "Linux USB Ethernet/RNDIS Gadget" driver installed on Android for that, and I'm pretty sure this driver is not included in the standard Android package.

Using a wireless connection would be much easier.

  • Voted this up, because he is right, but then thought of a way around this. – GuySoft Jun 7 '13 at 11:09
  • No, this posting makes an invalid assumption that there is only one way to do it. – Chris Stratton Nov 19 '15 at 18:18
  • It is possible. I do it all the time with my Pi A+ using Termius on Android. – Tooniis Oct 5 '18 at 12:07
0

You might want to read my answer here. It describes how to connect to ssh using USB tethering and your Pi. Bonus: you can even add android's WiFi hotspot to that solution and connect more devices.

If that's not enough, you can use adb to forward your SSH port with adb forward <local> <remote> and adb reverse <remote> <local>

From my experience, you will need a recent adb build, which you'll have to compile yourself as described in my answer here.

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.