Since the release of Android’s Gingerbread version, Google made what was probably a market-and technology-driven decision to use the Media Transfer Protocol (MTP) when an Android device is connected to a desktop. The old way, “USB Storage,” was as simple as it gets, with your Android device showing up in Linux file managers like a thumb drive. But with MTP, which is supposed to make your device appear as a media player, doesn’t work out of the box on Linux. However, with a couple of quick changes, you can make it happen.
Access via MTP (aka “The Hard Way”)
In addition to the way described here using gMTP, you can also configure a connection that lets you use your file manager (Nautlius in Ubuntu, or Dolphin in Kubuntu) to move files around. You’ll be mounting the device’s “/mnt/sdcard” to a directory on your Linux box, so you’ll be able to use a number of Linux-based tools, including rsync/unison, back-up tools, etc…
1. First, you’ll need to install the tools necessary to support an MTP connection, and then to connect the Android’s filesystem to the Linux one. You can do this on an Ubuntu distribution with the following commands:
2. Next, download this file to your Home folder, and give it a name… I called it “mount-prime.sh” (if you find you can’t run it from the terminal once installed, make sure it’s permissions are set to be executable).
3. Then, once you connect the Android device via a USB cable, you can use the name of the script as the command to mount/unmount your device to the “/media/Transformer” directory (i.e. for me, typing “
mount-prime.sh” in the terminal will mount my Transformer, and repeating the command will unmount it). If you don’t see it right away, don’t worry, it takes a good amount of time for the actual connection to happen.
Now you can interact with your Android device files like you would any other directory.
Access via SFTP (aka “The Easy Way”)
There are a couple of things that make the MTP route less than ideal. As noted above, it takes a long time for the connection to start up, and once it does, it takes even longer for the files to transfer back and forth. But serving up the files from the Android device via SFTP will also work with existing file managers, and be faster and not require a direct connection as well.
To use this, you’ll need to install the SSHDroid Android app. Once this is installed, literally the only thing you’ll need to do is start it up. The SFTP service will start up automatically, and display a screen like the one below:
This shows you the IP address you’ll need to access. You can either type this directly into a file manager’s URL bar, or use the functions in each to create a shortcut for your device.
1. In Nautilus, select “File > Connect to a Server,” then fill out the fields as shown below… the IP address and port should match what is shown on the SSHDroid screen.
Also, note that if you fill in the port number shown in SSHDroid (port 2222) and then select the “SSH” as the Type, it will automatically change the port number to the default for SSH connections (22). The default username is “root,” and the default password (if you didn’t change it on the SSHDroid Preferences screen) is “admin.” Once you click the “Connect” button, you’ll see the contents of your Android device in the Nautilus window.
2. In Dolphin, click on the “Network” item on the left-hand side, then “Add a Network Folder.” The first screen of the wizard will ask you for the connnection type – select Secure Shell here.
The next screen will ask for some details, similar to those Nautilus asked for.
Fill these in based on the user name, IP address, and password, then select “sftp” as the Protocol. There’s also a checkbox to save a shortcut to your device, but it will only work if your IP address is the same, so give your device a static or pre-assigned DHCP IP address if you want to use this.
Once you’re connected, you can copy, move, synchronize, or even open and edit the files on your device directly from your favorite file manager window.