How to mount partitions without root access in Ubuntu

Mounting partitions in Ubuntu or any Linux systems is achievable via two approaches.
The first way is to mount the partitions from root user which usually the partitions are pointed to /mnt/. This is more or less a classical method with systemwide effect.
The second approach which is the topic of this post is to add the partitions per-user without root access. The mechanism works in quite the same way with what Nautilus uses to mount partitions and external storages flawlessly with one click, means mounting partitions to /media/[USER]/[Partition name/UUID].
However, the story is slightly different when using only command line. In that scenario, partitions and external disks should be mounted manually via a tool called udisksctl.
To mount a partition regardless of its filesystem, use a command similar to the examples,

$ udisksctl mount --block-device /dev/sda5 #A partition location on device directory

Another example,

$ udisksctl mount --block-device /dev/sda3

By contrast of classic mount command, there is no need to specify mounting point as udiskctl uses /media/[USER]/[partition name/UUID] as default mounting path.
To unmount a partition use a command similar to below,

$ udisksctl mount --block-device /dev/sda5

Further reading,
https://help.ubuntu.com/community/AutomaticallyMountPartitions#Per-User_Mounts

Leave a Reply