Search code examples
androidadbwifi

Disable ADB over wifi but leave connection over USB functioning


I have device with android installed that needs to be available in company network. Device is Khadas Vim3 single board computer and is fully rooted.

ADB connection over wifi is enabled by default.

Command adb usb will disable connection over wifi, but after device reboot its enabled again and anyone who knows IP address can connect to it. I want to disable disable connection over wifi permamently. It needs to be turned off when device is rebooted. Only connection over usb should be enabled.


Solution

  • Khadas Vim3 have info about adb tcp port stored in file /vendor/build.prop.

    To edit this file first remount /vendor directory writable. mount -o rw,remount /vendor

    Then edit build.prop file vi /vendor/build.prop and change value for option service.adb.tcp.port to -1. Former value is 5555

    New value: service.adb.tcp.port=-1

    Then remount /vendor as read only mount -o ro,remount /vendor

    And reboot device.

    After that adb no longer connects to device through wifi but can connect through usb.