[How To] Enable MTP in Linux for Android 4.0 and above


Google introduced MTP with Android 4.0, mainly because that used a single partition for the internal storage and also this enabled the usage of secondary storage even when it was being used by the PC and contents are being transferred. MTP works really well in the windows platform basically because of the drivers available. It is a real problem to use MTP on computers with any O.S other than Windows. Thanks to the guys at XDA who have come up with a solution. This guide will help all the Linux users out there to set up MTP on their computers.

All you need to do is fire up terminal and enter the following codes. The codes are different for different Linux distros so just check before you enter them.

This procedure is for One X, if you are using this procedure for any other device, replace the onex with your device name and it should work.

Codes for Debian based distros:

sudo apt-get install mtpfs
sudo mkdir /media/onex
sudo chmod 775 /media/onex
sudo mtpfs -o allow_other /media/onex gedit /etc/udev/rules.d/51-android.rules
(add the following line:)
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
and then:
sudo service udev restart

Code for Arch Linux distros:

pacman -S libmtp

After installation, you have several mtp tools available. Upon connecting your MTP device, you use:

mtp-detect

(add the following line:)
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
and then reload udev rules:
udevadm control --reload

Source: Xda-developers