Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication every time to mount as a root user #1251

Open
Jebrano opened this issue Feb 6, 2024 · 3 comments
Open

Authentication every time to mount as a root user #1251

Jebrano opened this issue Feb 6, 2024 · 3 comments

Comments

@Jebrano
Copy link

Jebrano commented Feb 6, 2024

After an update couple of weeks ago, I kept getting a pop-up asking for permission to mount any partition, even though I have always been a root user, it used to mount them automatically on login, and I don't know the reason why it has changed.

I followed these instructions to grant myself permission, but it didn't work.
I also tried adding the partitions entry to /etc/fstab/ but it made my system boot into emergency mode, so I stopped messing with it.
I don't know what to do next.
Here is the pop-up
image
The content of 50-udiskie.rules with the appropriate file permission.

polkit.addRule(function(action, subject) {
  var YES = polkit.Result.YES;
  var permission = {
    // required for udisks1:
    "org.freedesktop.udisks.filesystem-mount": YES,
    "org.freedesktop.udisks.luks-unlock": YES,
    "org.freedesktop.udisks.drive-eject": YES,
    "org.freedesktop.udisks.drive-detach": YES,
    // required for udisks2:
    "org.freedesktop.udisks2.filesystem-mount-system": YES
    "org.freedesktop.udisks2.filesystem-mount": YES,
    "org.freedesktop.udisks2.encrypted-unlock": YES,
    "org.freedesktop.udisks2.eject-media": YES,
    "org.freedesktop.udisks2.power-off-drive": YES,
    // required for udisks2 if using udiskie from another seat (e.g. systemd):
    "org.freedesktop.udisks2.filesystem-mount-other-seat": YES,
    "org.freedesktop.udisks2.filesystem-unmount-others": YES,
    "org.freedesktop.udisks2.encrypted-unlock-other-seat": YES,
    "org.freedesktop.udisks2.encrypted-unlock-system": YES,
    "org.freedesktop.udisks2.eject-media-other-seat": YES,
    "org.freedesktop.udisks2.power-off-drive-other-seat": YES
  };
  if (subject.isInGroup("root")) {
    return permission[action.id];
  }
});

and here is how I wrote the new partition line in /etc/fstab:

UUID=10746B3E-7447-4AD6-BE14-FA386F2CB999 /run/media/jubran/Extra\040Data ntfs defaults 0 2
@tbzatek
Copy link
Member

tbzatek commented Feb 8, 2024

The polkit prompt looks sane. Nothing has changed on UDisks side other than introducing org.freedesktop.udisks2.filesystem-mount-other-user action which is not your case according to the screenshot.

Any messages from the udisksd process? This looks like your polkit rules override doesn't work. If you enter the password, does it mount properly?

@Jebrano
Copy link
Author

Jebrano commented Feb 9, 2024

@tbzatek yes it does mount properly, and how can I see messages from the process, I didn't even invoke it from the terminal, but when I do try to mount from the terminal and cancel the auth request this message print out Error mounting /dev/sda2: GDBus.Error:org.freedesktop.UDisks2.Error.NotAuthorized: Not authorized to perform operation

@tbzatek
Copy link
Member

tbzatek commented Feb 27, 2024

@tbzatek yes it does mount properly, and how can I see messages from the process, I didn't even invoke it from the terminal

Depends on your distribution. Most common is logging into /var/log/messages, some init systems may redirect the daemon messages elsewhere. Also depends whether udisksd was started by an init system or autostarted by dbus daemon.

but when I do try to mount from the terminal and cancel the auth request this message print out Error mounting /dev/sda2: GDBus.Error:org.freedesktop.UDisks2.Error.NotAuthorized: Not authorized to perform operation

That works as expected, also indicates that your polkit rule override doesn't work.

As the rules look like using JavaScript scripting, make sure that your polkit daemon is built with scripting support. Newer polkit releases allowed use of duktape JavaScript engine instead of SpiderMonkey. Perhaps it's disabled altogether.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants