Gentoo Archives: gentoo-user

From: Ramon Fischer <Ramon_Fischer@×××××××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Disable password required to mount removable hard disk. (solved)
Date: Thu, 01 Apr 2021 11:59:14
Message-Id: AM6PR10MB24403962FA01F418F807A249EF7B9@AM6PR10MB2440.EURPRD10.PROD.OUTLOOK.COM
In Reply to: Re: [gentoo-user] Disable password required to mount removable hard disk. (solved) by William Kenworthy
1 Awesome!
2
3 I am glad to hear, that I could help. :)
4
5 -Ramon
6
7 On 01/04/2021 13:28, William Kenworthy wrote:
8 > In the end it was easy: created a polkit rule enabling users in the
9 > wheel group to not use a password.
10 >
11 > rattus ~ # cat /etc/polkit-1/rules.d/55-disks.rules
12 >
13 > // Allow any user in the 'wheel' group to mount a disk
14 > // without entering a password.
15 >
16 > polkit.addRule(function(action, subject) {
17 >     if (action.id == "org.freedesktop.udisks2.filesystem-mount-system" &&
18 >         subject.isInGroup("wheel"))
19 {
20 >         return polkit.Result.YES;
21 >     }
22 > });
23 > rattus ~ #
24 >
25 > Thanks for the polkit hint.
26 >
27 > BillK
28 >
29 >
30 > On 1/4/21 6:08 pm, William Kenworthy wrote:
31 >> Hi, I only have a default polkit rule - nothing about usb.
32 >>
33 >> Just noticed the mount dialog box contains:
34 >>
35 >> Action: org.freedesktop.udisks2.filesystem-mount-system
36 >>
37 >> Vendor: The Udsks Project"
38 >>
39 >> I have found some documents on the web, but nothing yet on how to deal
40 >> with this issue.
41 >>
42 >> BillK
43 >>
44 >>
45 >> On 1/4/21 3:21 pm, Ramon Fischer wrote:
46 >>> Addendum:
47 >>>
48 >>> I forgot to answer your other question:
49 >>>
50 >>> Maybe you also have set some rules in "/etc/polkit/rules.d/"[1], which
51 >>> allows your unprivileged user to mount USB drives and SD cards without
52 >>> any password.
53 >>>
54 >>> -Ramon
55 >>>
56 >>> [1] https://wiki.gentoo.org/wiki/Polkit
57 >>>
58 >>> On 01/04/2021 09:13, Ramon Fischer wrote:
59 >>>> Hello BillK,
60 >>>>
61 >>>> I guess, that you are looking for the mount option "user":
62 >>>>
63 >>>>    /etc/fstab
64 >>>>
65 >>>>    /dev/sdx         /<some_path>       ext4 noauto,user,relatime
66 >>>> 0       2
67 >>>>
68 >>>> In this way, I can mount "/dev/sdx" with an unprivileged user:
69 >>>>
70 >>>>    $ mount /<some_path>
71 >>>>
72 >>>> See also "man 8 mount" ("Non-superuser mounts").
73 >>>>
74 >>>> I am not sure, if this also works with "automount" from
75 >>>> "net-fs/autofs", if this is what you meant with "automounter".
76 >>>>
77 >>>> -Ramon
78 >>>>
79 >>>> On 01/04/2021 06:51, William Kenworthy wrote:
80 >>>>> Hi,
81 >>>>>
82 >>>>>       I use a sata drive caddy with 2Tb hard disks for offline backups.
83 >>>>> Almost everytime (within sessions are ok?) it asks for a password
84 >>>>> before
85 >>>>> automounting.  This is just annoying and has no security benefit in my
86 >>>>> environment (why just hard disks when USB keys and SD cards don't ask
87 >>>>> for one?).
88 >>>>>
89 >>>>> So, how can I disable the automounter asking for a password either in
90 >>>>> general, or just for my backup drives?
91 >>>>>
92 >>>>> BillK
93 >>>>>
94 >>>>>
95 >>>>>
96
97 --
98 GPG public key: 5983 98DA 5F4D A464 38FD CF87 155B E264 13E6 99BF

Attachments

File name MIME type
OpenPGP_signature.asc application/pgp-signature