Thursday, July 19, 2012

Connect Nexus 7 to Linux via MTP using USB

Android 4.1 use the MTP (Media Transfer Protocol) and Linux doesn't natively support MTP. Something it doesn't work well with Linux/Ubuntu. When I connect my Nexus 7 to a Server running Linux using USB, none USB device appears and I have to mount it via MTP for accessing the file system.

How to Connect Nexus 7 to Linux
Open the terminal window and type the commands to setup.
* First install the necessary tools:
  sudo apt-get install mtp-tools mtpfs
* Set up a UDEV rule
  gksu gedit /etc/udev/rules.d/51-android.rules
* Type this text in it. Make sure all are in a single line:
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0666", OWNER="your-username-in-the-linux"
* Set up a mount point
  sudo service udev restart
  sudo mkdir /media/Nexus7
  sudo chmod a+rwx /media/Nexus7
* Plug your Nexus 7  in and select MTP on the tablet, then enter:
  sudo mtpfs -o allow_other /media/Nexus7
* Now You can browse your Android phone contents or add/remove/modify files using Nautilus. When you need To unmount, try this:
  sudo umount mtpfs


  1. It works with my Nexus 7!
    Thank you!

  2. I just get Playlists and Internal folders. Clicking Internal just opens the device again.

  3. @Matt.
    Got same issue as yours initially,
    Fixed by subs ATTR{idVendor} and ATTR{idProduct} values with your own Google device ID from lsusb.

    run lsusb, you will see this something like,
    Bus 001 Device 010: ID 18d1:4e41 Google Inc.
    18d1 is the idVendor
    4e41 is the idProduct

  4. Thanks, that helped a bunch!

  5. Works with my Nexus 7, Thanks !

  6. thanks a lot...helped me a lot :)

  7. Thanks a million!

  8. Thanks! you are the man! I think I love u!... can you explain why is it necessary?

    Thanks again.

  9. Thank you. This worked well for me with Daniel's comment making all the difference. I only see the folders:
    Alarms DCIM Movies Notifications Playlists Ringtones
    Android Download Music Pictures Podcasts
    I wanted to copy my clockworkmod backup to ubuntu but I am still struggling to see that :(

  10. this didn't work for me... i followed the directions but it is saying file not found when i double click the Nexus7 folder

  11. Great and simple, thank you!
    Worked on Linux Mint + Nexus 7

  12. Thanks a lot!
    Worked in my ubuntu 12.04 LTS

  13. Works on Ubuntu 11.04 with Daniel's comment, i.e. the idVendor and idProduct needed changing.

  14. thanks a lot works well

  15. Thanks, it worked first time!
    Ray Carbuhn

  16. 10x - Works with Daniels note. But it's slooooooooow. Better install ES File Explorer on the tablet and transfer files from/to shared PC foler(s)

  17. 10x - Works with Daniels note about lsusb. But so slooooooow. Better install ES File Explorer from market and then transfer from/to shared PC folder(s)

  18. For those who don't want to deal with MTP, there's always mounting over wifi with sshfs and the SSHDroid app.

    I've been using that on my gnexus and nexus 7.

  19. Couldn't quite get this method to work. downloaded a program from the Ubuntu software center called gMTP. Was able to get my music on to my Nexus using that. Not as seemless as dragging and dropping files there but it did what I needed it to so.

  20. This method did not work for me. I ended up downloading gMTP from the Ubuntu software center. I was able to connect and copy my music from my Ubuntu Pc to the Nexus 7 pretty quickly. Not as easy as drag and drop or copy and paste but did what I needed

  21. if you don't get this worked on nautilus, try other file managers like PCManFM.

  22. works well thank you guys!!!!

  23. Followed this and everything worked fine. Was able to move movies and stuff to my Nexus 7. Thanks Alot :D

  24. Thank you SO MUCH.

    It worked flawlessly.

    Nexus7 running jellybean 4.2.2 (unmodified). And ubuntu 12.04.