Android Blog‎ > ‎

● An alternative to MTP to transfer files between your smartphone and your computer

posted 22 Mar 2017, 06:07 by Dominique Cressatti   [ updated 21 Jul 2017, 04:09 ]

If in you've been transferring files between your Android smartphone and you computer over MTP, you must have noticed that it is a painfully slow and an unreliable experience, especially if like me you're using Linux. Here's a crafty alternative using USB tethering and an FTP server running on the smartphone, which will also let you access the whole content of the smartphone SD Card, rather than just the pictures and music folders when done with MTP. USB tethering works using Ethernet over USB which creates network interfaces to which IP addresses can be assigned. So basically once you've plugged your smartphone to your computer with a USB data cable and enabled USB tethering, an Interface named: RNDIS with the IP address: 192.168.42.129 gets created on the smartphone and an Interface named: usb0 with an IP address within: 192.168.42.0/24 gets created on your Linux Box. 

And then all you need is to run an FTP server on your smartphone. There are a lot of FTP server applications on the Google Playstore but personally I use the builtin FTP server that comes with ES File Explorer Pro, which allows me to upload to and download files on my smartphone. If you're looking for a free alternative, rather than pay for ES File Explorer Pro, here is a copy of the last free version of ES File Explorer before it's been bloated it with adware (bear in mind that to install it, you'll have to enabled Unknown sources under Settings ➡️ Security). 

Wrapping it up, here's an example based on using ES File Explorer and a Linux box:
  1. Plug your smartphone to your Linux box with a USB data cable.
  2. On you smartphone, go into  Settings ➡️ Wireless & Networks ➡️ More (or plus) ➡️ Tethering & Portable Hotspot ➡️ USB Tethering and enable it.
  3. Make sure that you've been assigned an IP address on usb0. If not assign one manually.
  4. Make sure that you can ping 192.168.42.129.
  5. Launch ES File Explorer, go into Menu ➡️ Network ➡️ Remote Manager and turn it on.
  6. Launch an FTP client on your Linux box pointing to 192.168.42.129 on port 3721.
Here's what it looks like on my Linux box. Accessing the content of the SD Card over FTP, using KDE Dolphin.


Troubleshooting:
  • Obviously if you can't ping your smartphone on 192.168.42.129, you're not going to get anywhere.
  • Check if you can connect to your FTP server over WIFI. If it doesn't work then you have a problem with the FTP server.
  • If you're using ES File Explorer make sure that in the Settings you have sett the root directory to your SD Card correct path. Otherwise if you've set it to / and your device isn't rooted, it won't work.
  • Check that your FTP server isn't restricted to listen on a specific IP address and excluding 192.168.42.129. To do that you can connect to your smartphone over and ADB shell session and type netstat -ant. Using ES File Explorer, this is what I get. My FTP server is running on port 3721 and listening on all IP addresses (yeah I know listening on all IP addresses can be a security risk but in this particular case, only if you still WIFI enabled and allow anonymous access).