Two Ways to Access Your Android Device with Linux File Managers

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 “” (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 “” 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.


  1. MTP sucks balls. This really irritates me about android/google.
    I want direct mass storage access to my android phone under linux.
    Having to workaround MTP or access wirelessly following rooting is an affront. Shame on you google.

  2. Hi Aaron.

    Many thanks for posting this – both methods enable me to connect but I am having difficulty getting files to transfer via the first (preferred) method. For My Galaxy Ace 2, I do:

    sudo mkdir /media/GalaxyAce
    sudo chmod 775 /media/GalaxyAce
    sudo mtpfs -o allow_other /media/GalaxyAce

    But files don’t appear when I send them.

    I also can’t create directories – I get a message:

    $ mkdir /media/GalaxyAce/Card/NewDir
    mkdir: cannot create directory `/media/GalaxyAce/Card/NewDir’: File exists

    $ ls -l /media/GalaxyAce/


    drwxrwxrwx. 2 username rgroup 0 Jan 1 1970 Card
    drwxrwxrwx. 2 username rgroup 0 Jan 1 1970 Phone
    drwxrwxrwx. 2 username rgroup 0 Jan 1 1970 Playlists

    $ mount
    mtpfs on /media/GalaxyAce type fuse.mtpfs (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)

    Any ideas how to fix this?


    1. Hi John,

      Thanks for your comment. Regarding the results of your “ls -l” command, are “username” and “rgroup” the log-in account and group of the user you’re issuing the other commands as?

      If not, you may be running into permission issues trying to create (i.e. send) files or folders to a mount point that’s owned by another user. Although even if you’re not the same user (“username”), the second “7” in the chmod command should make them writable if you’re in the same group (“rgroup”). But those look like names you replaced for the sake of anonymity.

  3. Nice. Since I spent a day trying to get MTP to work on my new Galaxy Ace IIx, without success (a quite different machine than the Ace 2 mentioned above), finding that I could just set up an SSH server was exactly what I needed. However, SSH Droid is, for many (including me) pretty flakey. “SSH Server” ( worked much better for me

  4. AirDroid is another way, and easier.

    1. Have you ever seen what airdroid pulls off of your device for it to work? They’re like nazis.

  5. @your script.
    This lines are deadly:
    sudo umount /media/Transformer
    sudo rm -r /media/Transformer

    You should use
    sudo umount /media/Transformer && sudo rm -r /media/Transformer

    In the first case if umount isn’t possible, the whole phone content will be deleted. In the second case the directory is just deleted if the umount was successful.

    1. Hi Chris,

      Good point, you’re right… except this isn’t my script. I’ve never had this happen (not to say it couldn’t), but you might want to let the script author know. You can find a way to contact him on his YouTube channel (, which is where I found the script originally as part of one of his videos.

  6. Thanks for this!

  7. MTP is sucky Microsoft shite.

    Installed sshdroid, but it only has access to a very small portion of the directory tree. Do I have to root the device to get the access I used to have when it was a mass storage device?

    1. Nope. You don’t have to root your device.

    2. Hi Otto,

      It should give you access by default to /sdcard, which will contain the majority of your data.

      I should also add that while it didn’t when I posted this, MTP actually works pretty well in Raring.

  8. Hi Otto,
    type: sftp -o Port=2222 root@aaa.bbb.ccc.ddd:/sdcard
    and you will see the contents of your internal card. To see an external SDCard on your device you can type cd /Removable (or wherever your external SDCard lives)

  9. Link at “this file” – – no longer exists. Any suggestions?

Comments are closed.