With pmount one can mount cds, dvds usb partitions (and what not) as a user. I wrote a program (in C) that wants to copy music (and stuff) from a removable device. I want to list these devices and present them to my user. Then I will mount the selected device with pmount, copy the stuff I want and then unmount it with pmount.

But I have no idea about how to list devices that are eligible for such task at a given moment.

I would prefer a pmount based solution if there is any. If there is no such option I would be satisfied with a good enough approximation using other (simlpe user runnable) tools.

I have Debian 7 on i686.


First approximation:

AFAIK pmount is just a setuid-wrapper for mount. I'm not sure if there are additional restrictions.

There are various udev-aliases for all block devices in /dev/disk/, e.g. /dev/disk/by-id/. There are also utility programs like lsblk (maybe lsblk -a -l etc.), or lsscsi. Pick the one that comes closest to what you want.

Those include the already mounted devices, though, so you have to remove them with a script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.