The file managers uses UDisks2 to mount the external drives without admin rights. GNOME, KDE, XFCE and various other desktop environments uses UDisks2
to allow normal users to mount removable media devices.
UDisks2
project provides a system daemon called udisksd
, and a command-line tool called udisksctl
.
The udiskd
daemon runs in the background and implements well-defined D-Bus interfaces that can be used to query and manipulate storage devices. udiskd
starts automatically at system boot and runs as root
all the time. You can verify it using command:
sudo systemctl status udisks2
Below are the steps to mount a usb disk without sudo
!
1. Find what the drive is called
You'll need to know what the drive is called to mount it. To do that enter the command below
lsblk
You're looking for a partition that should look something like: /dev/sda1
or /dev/sdb1
. The more disks you have the higher the letter this is likely to be. Anyway, find it and remember what it's called.
2. Mount using udisksctl
udisksctl mount -b /dev/sda1
Sample Output:
Mounted /dev/sda1 at /media/myusername/usb_stick_name.
3. Unmount the disk
Similarly, you can unmount the USB drive using command:
udisksctl unmount -b /dev/sda1