1

I was working on a project of mine and stumbled upon the USB mass storage mounting mechanism of ubuntu which confuses me quite a lot, let me explain.

I had never noticed that from a terminal in order to use the "mount" command you need to have root access i.e. "sudo mount". As I had only used it to mount drive partitions during an OS install it was fine.

On the other hand a USB thumb drive is automatically mounted (not the drive but rather the partitions) when connected to a computer (on the default Ubuntu install at least) without the current user having root access to the machine.

I first believed it was a matter of the automated process of mounting drives that had root access and allowed for the "mount" command but by going into the ubuntu "disks" utility one can easily unmount and mount again any partition of the USB thumb drive (by using the stop/play button) without being asked for any password granting root access. (I may have missed it)

It confuses me, How is the ubuntu disks utility able to mount the USB thumb drive partitions without having root access ?, Can I reproduce it from the terminal ?, If I can't, is there a native way in the classic ubuntu install to mount USB mass storage devices without requiring root access ?

I am already aware of some ways of mounting these USB partitions without root access by installing some additional packages, this is not what I'm interested in. I have seen https://help.ubuntu.com/community/Mount/USB where they talk about using "pmount" as well as USB Storage Device Automount where "usbmount" is discussed. As far as I can tell those packages are not installed on my system so this is not what is happening when the ubuntu disks utility is mounting the USB partitions.

I may be wrong about some things I said, I may have missed something obvious. Please help un-confuse me.

P.S: As an extra question, How can I partition those USB devices without root access ?

0

You can use udisksctl, and I think this tool uses the same back-end as the automount feature.

Example:

udisksctl mount --block-device /dev/sde5

See man udisksctl to learn more about this tool.


P.S: It is better to convert the extra question to a separate AskUbuntu question.

  • 1
    Worked to mount the USB device without root access and from the doc I believe this is responsible for the automount feature ie the udisksd daemon. But this is maybe not what is used when in the disk utility manager as in fact the disk utility mangager is gnome-disks but I could'nt find a way of partitionning the usb device from the terminal using this (still without root access). – vincent delmas Feb 5 at 14:07
  • @vincentdelmas, It is possible that the command line tools for partitioning themselves ask for elevated permissions (so it does not help that you can mount the partition without elevated permissions). By the way, the partition(s) should be unmounted when you try to create a partition or a file system. - But there are other people who know better than I how to create partitions, and you have better chances that they see your question, if you create a new AskUbuntu question with a suitable ttitle for that purpose. – sudodus Feb 5 at 14:13
  • For the follow up on partitioning the drive with the same restrictions as here, askubuntu.com/questions/1208339/… – vincent delmas Feb 5 at 18:50
  • @vincentdelmas, I have seen your new question. It is good. I don't know any command line method witthout elevated permissions and I wish you good luck; that someone who knows will help you. (I will not disturb that process with any comment, at least not tonight.) – sudodus Feb 5 at 19:34

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.