This forum has been archived. All content is frozen. Please use KDE Discuss instead.

What's the command for the user to mount without sudo?

Tags: None
(comma "," separated)
jistanidiot
Registered Member
Posts
11
Karma
0
OS
So when I plug in my USB drive, I can click on the little icon in the device notifier and it will mount the drive. It doesn't ask for a password or anything.

However when I try to mount the drive from the command line using something like
Code: Select all
mount -t ntfs-3g -U abcdefghi123456890 /media/backupdrive

it says I have to be root to do so.

What command is KDE using that doesn't require a sudo?

Something similar happens when I unmount it and I'd like that command too.

Thanks in advance.

[Edit: Thanks wolfi323 that works perfectly]

Last edited by jistanidiot on Mon Apr 29, 2013 6:42 pm, edited 1 time in total.
User avatar
google01103
Manager
Posts
6668
Karma
25
if the drive is always the same drive you could add an entry to /etc/fstab with the user and noauto options then you'd just need to do
Code: Select all
mount /media/backup


you can use the device notifier settings to automatically mount the drive without having to click, look at the removable devices -> device overrides section


OpenSuse Leap 42.1 x64, Plasma 5.x

Minio
Registered Member
Posts
177
Karma
1
OS
There is no single command. It's stack of udev, udisks and polkit, maybe among others. I admit that I do not fully understand it, so I can not explain the details.

If you are interested, you may take a look at Arch wiki article about udisks: https://wiki.archlinux.org/index.php/Udisks#Udisks .You will find example scripts that ease work with udisks there. Most (all?) of them should be generic enough to work on other distributions as well, at least as long as version numbers match.


Best regards
Mirosław Zalewski
wolfi323
Registered Member
Posts
1129
Karma
11
OS
Depends on which version you are using.

You can mount drives either with
Code: Select all
udisks --mount device_file

or
Code: Select all
udisksctl mount -b device_file
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
One may also use the "solid-hardware mount <udi>" command to mount a disk drive, although that requires retrieving the matching UDI first.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
shantanu
Registered Member
Posts
9
Karma
0
OS
solid-hardware mount <udi>


Perfect! That is exactly what I was looking for (one can get the udi by using `solid-hardware list`)


Bookmarks



Who is online

Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]