Page 1 of 2
[SOLUTION] mount internal partitions - permission problem

Posted:
Jul 4th, '11, 16:24
by dexter11
Hi everyone
I installed Mageia from the Gnome live CD.
I have 3 partitions that I'd like to mount automatically at boot. Currently if I click on them Nautilus always asks for authentication after each reboot for each of those partitions.
So the preferred behavior would be to just mount them.
The not so good way would be to switch off authentication.
I searched a little and the authentication part is likely related to PolicyKIt. But I stopped reading when it started to explain how to write XML files to achieve what I want.
Is there a simple GUI way to do this?
Re: auto mount of partitions

Posted:
Jul 4th, '11, 17:08
by Ken-Bergen
diskdrake is the GUI you want.
It lets you set mounting and read write policies for any partition on the machine even removable ones.
Re: auto mount of partitions

Posted:
Jul 4th, '11, 18:39
by doktor5000
You have two general choices: Mount them via /etc/fstab, as a particular user,
or make them mountable by users, or whatever you like.
Or you can obtain rights to mount local disks with the means of your DE, in your case GNOME.
Can be done with this command:
polkit-auth --user username --grant org.freedesktop.hal.storage.mount-fixed --constraint local
This only removes the requirement of the root password needed for mounting them. No XML files needed for that.
Re: auto mount of partitions

Posted:
Jul 5th, '11, 03:12
by Ken-Bergen
doktor5000 wrote:You have two general choices: Mount them via /etc/fstab, as a particular user,
or make them mountable by users, or whatever you like.
diskdrake is a graphical interface that writes /etc/fstab entries.
Making a partition mount auto-magically on boot and read write for all users is just a few clicks.
Re: auto mount of partitions

Posted:
Jul 5th, '11, 10:10
by doktor5000
Yes, i know that, and you already wrote that in your last comment.
Re: auto mount of partitions

Posted:
Jul 5th, '11, 10:40
by dexter11
Thanks for the help. Unfortunately this:
- Code: Select all
polkit-auth --user username --grant org.freedesktop.hal.storage.mount-fixed --constraint local
doesn't work. Nautilus still asks for authentication whenever I click on a partition. I substituted "username" with the name of the regular user account I normally use for login.
I knew about the old method (diskdrake) I just saw that there's a new system in the distro which automatically mounts partitions after authentication. I just thought that maybe this new system can mount automatically at boot time or when Gnome starts, without authentication. But if not I will use diskdrake and fix mount points.
Re: auto mount of partitions

Posted:
Jul 5th, '11, 17:51
by doktor5000
Maybe you should look at polkit-auth --help if any of the other constraints apply to you.
Re: auto mount of partitions

Posted:
Jul 6th, '11, 20:17
by dexter11
I did some detective work on PolicyKit and according to the documentation on
http://hal.freedesktop.org/docs/PolicyKit/ the /etc/PolicyKit/PolicyKit.conf file should be edited to overwrite the defaults. According to the man page of PolicyKit.conf the edited file should look like this:
- Code: Select all
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->
<!DOCTYPE pkconfig PUBLIC "-//freedesktop//DTD PolicyKit Configuration 1.0//EN"
"http://hal.freedesktop.org/releases/PolicyKit/1.0/config.dtd">
<!-- See the manual page PolicyKit.conf(5) for file format -->
<config version="0.1">
<match action="org.freedesktop.hal.storage.mount-fixed">
<match user="username">
<return result="yes"/>
</match>
</match>
</config>
I copied the
- Code: Select all
<match action="org.freedesktop.hal.storage.mount-fixed">
<match user="username">
<return result="yes"/>
</match>
</match>
part from the PolicyKit.conf man page. And it doesn't work either. Sometimes I really hate Linux.
Re: auto mount of partitions

Posted:
Jul 6th, '11, 22:49
by doktor5000
Well, that is interesting.
Could you please give a more detailed description of the partitions in questions? So which filesystem, device names and how you used them normally?
Lucky shot: Are they maybe NTFS partitions which need chkdisk, so ntfs-3g gives you a warning when mounting them?
Do you have any internal/external partitions that you can mount through your file manager without aksing for root password, like a removable drive or so?
Re: auto mount of partitions

Posted:
Jul 8th, '11, 20:50
by dexter11
/dev/sda1 NTFS
/dev/sda2 ReiserFS
/dev/sdb1 NTFS
What do you mean how do I use them normally?
I usually never mount on the command line, but I tried now and it didn't give me any errors or warnings.
I can mount DVDs without authorization.
Re: auto mount of partitions

Posted:
Jul 9th, '11, 17:04
by doktor5000
Well, mounting NTFS partitions works pretty well for me, whether they are internal or external/removable,
but this is under KDE. Does Nautilus provide you with some error message, or does it directly ask for a password?
About Reiser i don't know, but shouldn't matter.
So either you wait for some Gnome specialist to drop by, or go with diskdrake, as Ken-Bergen suggested.
Re: auto mount of partitions

Posted:
Jul 11th, '11, 09:49
by ahmad
Most DE's have switched from hal to udisks; that polkit-auth command won't work any more, IIUC.
You can give a certain user more privileges by creating a .pkla file, e.g. by creating 90-my-local-authentication.pkla in /etc/polkit-1/localauthority/50-local.d/ (must be done as root):
cat /etc/polkit-1/localauthority/50-local.d/90-my-local-authentication.pkla
- Code: Select all
[Local Authentication]
Identity=unix-user:user-name
Action=org.freedesktop.udisks.filesystem-mount-system-internal
ResultActive=yes
replace
user-name with your actual user name. (Thanks to this blog post for the tips
http://mdzlog.alcor.net/2010/06/27/navi ... ykit-maze/). Note that you can add more Actions, , e.g.
- Code: Select all
Action=org.freedesktop.udisks.filesystem-mount-system-internal;org.kde.ksysguard.processlisthelper.sendsignal
separating them with ';', (org.kde.ksysguard.processlisthelper.sendsignal would allow you to kill other users' processes in ksysguard, so use with care).
FWIW, for partitions that you use all the time, it's easier to just create mount points with them using diskdrake, and have them mounted automatically at boot.
Re: auto mount of partitions

Posted:
Jul 11th, '11, 22:42
by doktor5000
Whoa, thanks for that one Ahmad.
Would still be interesting to know why both NTFS and the Reiser partition can't be mounted via the file manager, to maybe fix the cause.
Re: auto mount of partitions

Posted:
Jul 17th, '11, 10:16
by dexter11
Thanks for everybody who tried to help.
First I tried to modify my /etc/PolicyKit/PolicyKit.conf file and replace org.freedesktop.hal.storage.mount-fixed with org.freedesktop.udisks.filesystem-mount-system-internal. That didn't work and resulted in unpredictable behavior, namely Gnome just stopped to work correctly.
But meanwhile I did create mount points and they just work.
Then i tried the pkla file method Ahmad wrote, just out of curiosity, and I can't unmount those partitions as a local user. So I assume I couldn't mount them either.
Re: auto mount of partitions

Posted:
Jul 25th, '11, 13:26
by doktor5000
Well, Ahmads method is working here under KDE.
Maybe you need to logout and login under GNOME before changes take effect?
@ahmad: Do you know where to get a complete complete list of those udisks actions,
like with polkit-auth --show-obtainable?
Re: auto mount of partitions

Posted:
Jul 25th, '11, 14:36
by ahmad
Well, Ahmads method is working here under KDE.
Maybe you need to logout and login under GNOME before changes take effect?
AFAIK, the changes should take effect immediately, without a logout -> login.
@ahmad: Do you know where to get a complete complete list of those udisks actions,
like with polkit-auth --show-obtainable?
I don't know of a command to list them; however check the files in /usr/share/polkit-1/actions/ .
Re: auto mount of partitions

Posted:
Jul 26th, '11, 09:55
by doktor5000
Yeah, thanks again.
I guess this can be marked [solved].
Re: auto mount of partitions

Posted:
Jul 26th, '11, 13:44
by isadora
doktor5000 wrote:I guess this can be marked [solved].
Dexter11...how about you?
Re: auto mount of partitions

Posted:
Jul 26th, '11, 14:02
by doktor5000
dexter11 wrote:Thanks for everybody who tried to help.
[...]
But meanwhile I did create mount points and they just work.
Then i tried the pkla file method Ahmad wrote, just out of curiosity[...]
He hasn't posted again, so i assumed the problem was fixed for him. Sorry if that was too fast.
Re: auto mount of partitions

Posted:
Jul 26th, '11, 14:04
by isadora
Never mind, i prefer to hear from the OP.

Re: auto mount of partitions

Posted:
Aug 2nd, '11, 22:11
by dexter11
Sorry for the late answer.
I did create fixed mount points, as was suggested a couple of times, and my partitions are mounted automatically. So from that point of view it is solved.
However I still have no idea how to configure PolicyKit to auto mount my partitions. Which was the original question. So from that point of view it's not solved.
I don't know what's different on a live CD install than on a regular install but Ahmad's method doesn't work here and I really don't wanna waste any more time on this. So thanks all who tried to help.
Re: auto mount of partitions

Posted:
Aug 3rd, '11, 09:48
by doktor5000
Could you please show the output of
- Code: Select all
rpm -V policykit
Re: auto mount of partitions

Posted:
Aug 4th, '11, 15:26
by dexter11
- Code: Select all
# rpm -V policykit
S.5....T. c /etc/PolicyKit/PolicyKit.conf
.......T. /var/lib/misc/PolicyKit.reload
Re: auto mount of partitions

Posted:
Aug 4th, '11, 15:35
by doktor5000
Seems your changes are still there, at least file size and md5sum of the first file changed:
http://www.rpm.org/max-rpm/s1-rpm-verify-output.htmlSo you should do
rm -f /etc/PolicyKit/PolicyKit.conf && urpmi --replacepkgs policykitThen i'd like to see
- Code: Select all
ls -la /etc/polkit-1/localauthority/50-local.d/
Re: auto mount of partitions

Posted:
Aug 4th, '11, 18:00
by dexter11
- Code: Select all
# ls -la /etc/polkit-1/localauthority/50-local.d/
összesen 4
drwxr-xr-x 2 root root 104 aug 2 22:27 ./
drwx------ 7 root root 200 máj 31 05:44 ../
-rw-r--r-- 1 root root 129 aug 2 22:27 90-csaba-local-authentication.pkla