2

How can I connect ADB on remote server through SSH to a local, non-rooted Android devices without installing anything on the middleman with root?

This is what I want to achieve:

┌─────────┐                       SSH through internet
│ Physical│ USB cable  ┌────────┐ (outside LAN) ┌────────┐
│ Android ├───────────►│ Laptop ├──────────────►│ Cloud  │
│ device  │            └────────┘               │ server |
└─────────┘                                     └────────┘
192.168.0.5            192.168.0.7                            (internal IP address)
                       204.12.46.76             108.63.15.64  (public IP address)

The one in the middle must not install any software with root/sudo. The laptop and server are both running Ubuntu 22.04.

From Android device to laptop, I can use the physical USB cable. From laptop to cloud server, I can use local SSH port forwarding (ADB uses port 5037). However, I do not know how to go from "physical USB cable" to "port 5037".

I include the relevant (fake) internal and external IP addresses for demonstration only.

3
  • In Laptop you should simply execute adb start-server to make sure adbd is running. Then port forwarding can forward TCP 5037 from Laptop to Cloud so that an adb client on the cloud server can connect to the adb server on the Laptop.
    – Robert
    Sep 18, 2023 at 8:10
  • @Robert the laptop does not have ADB installed (Command 'adb' not found, but can be installed with: sudo apt install adb) and the laptop must not install any software that doesn't exist on a fresh Ubuntu 22.04 install (a non-root install is acceptable).
    – ecokjeonb
    Sep 18, 2023 at 15:03
  • 1
    Sorry, I don't care how you install it, but the Laptop and Clout server need adb. I usually prefer the latest version from Android SDK, but if you want to use the one from Ubuntu package manager it should be fine, too.
    – Robert
    Sep 18, 2023 at 15:36

1 Answer 1

1

It is possible to install ADB without root by downloading directly:

curl -LO https://dl.google.com/android/repository/platform-tools-latest-linux.zip
unzip platform-tools-latest-linux.zip
cd platform-tools
./adb version

To use it through SSH, see this other Stack Exchange post.

You must log in to answer this question.

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