site  contact  subhomenews

adb connection to phone over wifi

August 09, 2018 — BarryK

I posted yesterday about using 'adb' and 'adbfs' over usb to browse files on my Android phone:

http://bkhome.org/news/201808/android-tools-and-adbfs-rootless-in-oe.html

Briefly mentioned that it could be done over wifi as well. Yes, this site has a nice explanation:

https://futurestud.io/tutorials/how-to-debug-your-android-app-over-wifi-without-root

It does require a one-time usb connection to enable the phone to listen on port 5555. With usb-debugging enabled on the phone and usb cable connected to PC, on the PC:

# adb devices
...this will confirm the connection
# adb shell "ip route"
192.168.1.0/24 dev wlan0  proto kernel  scope link  src 192.168.1.8
...192.168.1.8 is the ip-address of the phone.
# adb tcpip 5555
...starts the phone listening on port 5555

Then unplug the usb cable, and on the PC:

# adb connect 192.168.1.8:5555
# adb shell "ls /sdcard"
...will list folders and files on phone
# adbfs /mnt/phone
...can browse the files
# fusermount -u /mnt/phone

Yeah it works, but not very secure. Port 5555 stays open until the phone is rebooted. adbfs is a simple method, but reckon will restrict to only doing it via usb cable.

Tags: easy, quirky, linux