0

I have a Meizu M8 phone running android with Termux. I had set up ssh access to Termux over WiFi, but I want to be able to do that over USB because of possibly lower latency and higher speed. If I connect the phone to my macbook using USB, I can use adb to get shell or transfer files, so I think ssh over USB is possible. How can I achieve this?

Joy Jin
  • 117
  • 2
  • 1
    SSH isn't aware of if you are connected over WiFi or USB. It just needs a IP/TCP network to work. Use the phone's new IP address assigned over USB tethering. – Irfan Latif Jun 25 '20 at 04:18
  • You can set-up a TCP port forwarding using adb (forward device port to a port on your mac). Then the SSH port would be tunneled through the adb (USB) connection. In the end you could connect via ssh to a port on localhost and end up on the device. – Robert Jun 25 '20 at 07:46
  • @Robert How would I do that? – Joy Jin Jun 25 '20 at 09:00
  • @JoyJin if you are suing adb over USB, simply use adb pull and adb push or adbfs for data transfer. No need to use SSH. In my previous comment I though you are using USB tethering. // Port forwarding is explained here: https://android.stackexchange.com/a/207342/218526 – Irfan Latif Jun 26 '20 at 09:35

0 Answers0