romanzolotarev.com: support and follow me on Mastodon and Twitter

Tested on OpenBSD 6.4 with simple-mtpfs 0.3.0

Mount file system via Media Transfer Protocol on OpenBSD

First, find your uid and gid:

$ id -u
1000
$ id -g
1000
$

Connect your phone, camera, or any other MTP compatible device to your computer. Set the device to MTP mode.

For example, on Android 8.0 it's called Transfer files.

Then as root install simple-mtpfs and mount a file system via MTP with your uid:

# pkg_add simple-mtpfs
quirks-3.16 signed on 2018-10-12T15:26:25Z
simple-mtpfs-0.3.0p0:libusb1-1.0.21p1: ok
simple-mtpfs-0.3.0p0:libmtp-1.1.15: ok
simple-mtpfs-0.3.0p0: ok
# mkdir -p /mnt/mtp
# simple-mtpfs --device 1 /mnt/mtp -o uid=1000 -o gid=1000 -o allow_other
#

Use the file system as a regular user:

#
$ df /mnt/mtp
Filesystem  512-blocks      Used     Avail Capacity  Mounted on
fusefs       291042488  42956896 248085592    15%    /mnt/mtp
$ touch /mnt/mtp/test
$ ls -l /mnt/mtp/test
-rw-r--r--  1 romanzolotarev  romanzolotarev  0 Nov  5 16:29 /mnt/mnt/test
$

To unmount run as root:

# umount /mnt/mtp
#