[SOLUTION] mount internal partitions - permission problem

Here you'll find a place for solutions and hints.

Please use one of the support subforums below for questions or if you have any issues and need support.

[SOLUTION] mount internal partitions - permission problem

Postby dexter11 » Jul 4th, '11, 16:24

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?
Last edited by doktor5000 on Apr 27th, '13, 14:28, edited 1 time in total.
Reason: adjusted thread title
dexter11
 
Posts: 13
Joined: Jul 4th, '11, 16:11

Re: auto mount of partitions

Postby Ken-Bergen » Jul 4th, '11, 17:08

diskdrake is the GUI you want.
It lets you set mounting and read write policies for any partition on the machine even removable ones.
Ken
Ken-Bergen
 
Posts: 1019
Joined: Mar 30th, '11, 02:45
Location: Chilliwack, BC, Canada

Re: auto mount of partitions

Postby doktor5000 » Jul 4th, '11, 18:39

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.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 16719
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: auto mount of partitions

Postby Ken-Bergen » Jul 5th, '11, 03:12

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.
Ken
Ken-Bergen
 
Posts: 1019
Joined: Mar 30th, '11, 02:45
Location: Chilliwack, BC, Canada

Re: auto mount of partitions

Postby doktor5000 » Jul 5th, '11, 10:10

Yes, i know that, and you already wrote that in your last comment.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 16719
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: auto mount of partitions

Postby dexter11 » Jul 5th, '11, 10:40

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.
dexter11
 
Posts: 13
Joined: Jul 4th, '11, 16:11

Re: auto mount of partitions

Postby doktor5000 » Jul 5th, '11, 17:51

Maybe you should look at polkit-auth --help if any of the other constraints apply to you.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 16719
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: auto mount of partitions

Postby dexter11 » Jul 6th, '11, 20:17

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.
dexter11
 
Posts: 13
Joined: Jul 4th, '11, 16:11

Re: auto mount of partitions

Postby doktor5000 » Jul 6th, '11, 22:49

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?
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 16719
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: auto mount of partitions

Postby dexter11 » Jul 8th, '11, 20:50

/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.
dexter11
 
Posts: 13
Joined: Jul 4th, '11, 16:11

Re: auto mount of partitions

Postby doktor5000 » Jul 9th, '11, 17:04

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.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 16719
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: auto mount of partitions

Postby ahmad » Jul 11th, '11, 09:49

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.
ahmad
 
Posts: 336
Joined: Mar 22nd, '11, 20:18
Location: Egypt

Re: auto mount of partitions

Postby doktor5000 » Jul 11th, '11, 22:42

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.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 16719
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: auto mount of partitions

Postby dexter11 » Jul 17th, '11, 10:16

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.
dexter11
 
Posts: 13
Joined: Jul 4th, '11, 16:11

Re: auto mount of partitions

Postby doktor5000 » Jul 25th, '11, 13:26

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?
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 16719
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: auto mount of partitions

Postby ahmad » Jul 25th, '11, 14:36

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/ .
ahmad
 
Posts: 336
Joined: Mar 22nd, '11, 20:18
Location: Egypt

Re: auto mount of partitions

Postby doktor5000 » Jul 26th, '11, 09:55

Yeah, thanks again.

I guess this can be marked [solved].
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 16719
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: auto mount of partitions

Postby isadora » Jul 26th, '11, 13:44

doktor5000 wrote:I guess this can be marked [solved].

Dexter11...how about you?
..........bird from paradise..........

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
—Antoine de Saint-Exupéry
User avatar
isadora
 
Posts: 2680
Joined: Mar 25th, '11, 16:03
Location: Amsterdam, the Netherlands

Re: auto mount of partitions

Postby doktor5000 » Jul 26th, '11, 14:02

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.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 16719
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: auto mount of partitions

Postby isadora » Jul 26th, '11, 14:04

Never mind, i prefer to hear from the OP. ;-)
..........bird from paradise..........

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
—Antoine de Saint-Exupéry
User avatar
isadora
 
Posts: 2680
Joined: Mar 25th, '11, 16:03
Location: Amsterdam, the Netherlands

Re: auto mount of partitions

Postby dexter11 » Aug 2nd, '11, 22:11

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.
dexter11
 
Posts: 13
Joined: Jul 4th, '11, 16:11

Re: auto mount of partitions

Postby doktor5000 » Aug 3rd, '11, 09:48

Could you please show the output of
Code: Select all
rpm -V policykit
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 16719
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: auto mount of partitions

Postby dexter11 » Aug 4th, '11, 15:26

Code: Select all
# rpm -V policykit
S.5....T.  c /etc/PolicyKit/PolicyKit.conf
.......T.    /var/lib/misc/PolicyKit.reload
dexter11
 
Posts: 13
Joined: Jul 4th, '11, 16:11

Re: auto mount of partitions

Postby doktor5000 » Aug 4th, '11, 15:35

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.html

So you should do rm -f /etc/PolicyKit/PolicyKit.conf && urpmi --replacepkgs policykit

Then i'd like to see
Code: Select all
ls -la /etc/polkit-1/localauthority/50-local.d/
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 16719
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: auto mount of partitions

Postby dexter11 » Aug 4th, '11, 18:00

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
dexter11
 
Posts: 13
Joined: Jul 4th, '11, 16:11

Next

Return to The magician suggests...

Who is online

Users browsing this forum: No registered users and 1 guest

cron