Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] udisks2: no automount as regular user
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
potuz
Guru
Guru


Joined: 30 Jan 2010
Posts: 378

PostPosted: Tue Jul 29, 2014 10:04 am    Post subject: [SOLVED] udisks2: no automount as regular user Reply with quote

EDIT: Marking this as solved, sorry for the noise: Arghhh, my rules where badly written and I blindly copied them from a different thread. I guess I'll keep this post in the hopes that it will be useful to someone. The rules that actually worked for me:
Code:

# cat /etc/polkit-1/rules.d/10-automount.rules
polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.udisks2.filesystem-mount" &&
        subject.user == "myuser") {
        return "yes";
    }
});


Hello, this problem has appeared in many threads in different disguises and I tried many of the solutions posted (reflected in this post below) but I still can't manage to get my system to aumount a usb stick.

My relevant use flags:
Code:

[ebuild   R    ] gnome-base/gvfs-1.20.2  USE="http systemd udev udisks -afp -archive -avahi -bluray -cdda -fuse -gnome-online-accounts -gphoto2 -gtk -ios -libsecret -mtp -samba {-test}"
[ebuild   R    ] sys-apps/systemd-212-r5:0/2  USE="acl filecaps firmware-loader gudev kmod pam policykit seccomp -audit -cryptsetup -doc -gcrypt -http -introspection (-kdbus) -lzma -python -qrcode (-selinux) (-ssl) {-test} -vanilla -xattr" PYTHON_SINGLE_TARGET="python2_7 -python3_2 -python3_3" PYTHON_TARGETS="python2_7 python3_3 -python3_2"
[ebuild   R    ] sys-fs/udisks-2.1.3:2  USE="gptfdisk systemd -cryptsetup -debug -introspection (-selinux)"


My rules
Code:

# cat /etc/polkit-1/rules.d/60-automount.rules
polkit.addAdminRule(function(action, subject) {
    return ["unix-group:wheel"];
});
polkit.addRule(function(action, subject) {
   if ((action.id == "org.freedesktop.udisks2.*")) {
       return polkit.Result.YES;
    }
});

My processes running
Code:
$ ps -aux | grep udisks
mariana   1855  0.0  0.1 273344  4464 ?        Sl   06:40   0:00 /usr/libexec/gvfs-udisks2-volume-monitor
root      1888  0.0  0.1 425840  5092 ?        Ssl  06:40   0:00 /usr/lib/udisks2/udisksd --no-debug
mariana   2119  0.0  0.0  10592   960 pts/0    S+   06:53   0:00 grep --colour=auto udisks

And anyway when I want to mount I am required to register as root:
Code:
$ udisksctl mount -b /dev/sr0
==== AUTHENTICATING FOR org.freedesktop.udisks2.filesystem-mount ===
Authentication is required to mount SanDisk Cruzer (/dev/sr0)
Authenticating as: root
Password:

What do I need to do?
Back to top
View user's profile Send private message
Niimura
n00b
n00b


Joined: 05 Jul 2004
Posts: 63

PostPosted: Fri Apr 17, 2015 6:00 am    Post subject: I figured out a better rule file. Reply with quote

Hi.. I got a similar situation as yours.

After I have done trials and errors for a day, I figure out a way to have pcmanfm performing automount, unmount and eject.

First, I follow the first post from ssuominen in this link https://forums.gentoo.org/viewtopic-t-858965.html

Then, wiki "polkit" gentoo.
https://wiki.gentoo.org/wiki/Polkit
From that wiki link, it said the rule actions can be found in
Code:

 /usr/share/polkit-1/actions


Here is the one which works for me:
At
Code:
 /etc/polkit-1/rules.d/

create a file:10-udisks.rules

Code:

polkit.addRule(function(action, subject) {
    if (( action.id == "org.freedesktop.udisks2.filesystem-mount" ||
    action.id == "org.freedesktop.udisks2.filesystem-mount-system" ||
    action.id == "org.freedesktop.udisks2.filesystem-unmount-others" ||
    action.id == "org.freedesktop.udisks2.eject-media-system" ||
    action.id == "org.freedesktop.udisks2.eject-media") &&
         subject.user == "ewo" ) {
        return "yes";
    }

});


**Replace "ewo" with your username.

That code lets you automount, unmount, and eject usb drives and cds.
Note: If you eject usb drive from pcmanfm, pcmanfm quits by itself. It's a known bug that I don't know how to fix.

After I made the rule files,

I added "ck-launch-session" and "dbus-launch" on the line that executes the window manger in ~/.xinitrc file.

My example is for pekwm window manager.
Code:
 exec ck-launch-session dbus-launch pekwm


Lastly, make sure pcmanfm doesn't executed with ck-launch-session and dbus-launch. So, simply type:

Code:
 pcmanfm

to run pcmanfm from shell console like xterm.
Otherwise, the rules do not work with pcmanfm.

Hopefully, what I posted here can help you.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum