HowTo: FTP over USB in Android

Share your wisdom. Not for support questions!

Moderator: How-to Curator

HowTo: FTP over USB in Android

Postby SoulSingin » July 30th, 2013, 2:13 pm

Discuss: FTP over USB in Android


One of the most frustrating limitations of recent Android releases is the loss of USB mass storage. You can transfer your pictures over PTP (Picture Transfer Protocol) and your music over MTP (Multimedia Transfer Protocol), but sometimes you just want to copy and paste some files.

If the files are small enough, you can easily transfer them over wireless FTP (File Transfer Protocol) using an app like SSH Droid (or AirDroid?), but transferring a lot of files is slow and burns up your wireless router.

A better solution is to use FTP to transfer the files over a USB connection. In a file manager like Dolphin, it feels just like USB mass storage. You can copy and paste with ease.

So let's get started. First, install SSH Droid on your Android device. In its options menu, disable the "Require WiFi" option, so that you can start the SSH server in the absence of a WiFi connection.

Next, install android-tools-adb on your Debian desktop computer to get the "Android Debug Bridge," a command-line tool that enables you to interact with an Android device from your desktop computer. Unless you're running Sid, you will have to backport the package yourself.

Once you have installed android-tools-adb, connect your device to your computer via USB, start SSH Droid and forward the FTP port. Here, we'll use port 5222 on our desktop computer. By default, SSH Droid uses port 2222.

Code: Select all
$ adb forward tcp:5222 tcp:2222


Now you're ready to tranfer files over USB, so open an FTP client like FileZilla (or better yet, a file manager like Dolphin) and connect to:

Code: Select all
sftp://root@127.0.0.1:5222/storage/


After you have finished transferring files, you should stop SSH Droid and remove the forwarded port:

Code: Select all
$ adb forward --remove 5222


Finally, you should append a few aliases to your ~/.bashrc file, to create some shortcut commands:

Code: Select all
##  port forwarding -- to transfer files via FTP over USB
alias adb-devices="adb devices -l"

alias adb-fwd-ftp="adb forward tcp:5222 tcp:2222"
alias adb-fwdlist="adb forward --list"

alias adb-rm-ftp="adb forward --remove 5222"
alias adb-rm-all="adb forward --remove-all"


Hope this helps,
- Soul Singin'
.
Wildflower seed in the sand and wind
May the four winds blow you home again
User avatar
SoulSingin
 
Posts: 519
Joined: February 9th, 2011, 1:21 pm

Return to HowTo

Who is online

Users browsing this forum: No registered users and 1 guest

cron

x