Questions tagged [polkit]

25 questions
9
votes
1 answer

How do I connect dbus and policykit to my function in python?

I am making a python application that has a method needing root privileges. From https://www.freedesktop.org/software/polkit/docs/0.105/polkit-apps.html, I found Example 2. Accessing the Authority via D-Bus which is the python version of the code…
answerSeeker
  • 2,692
  • 4
  • 38
  • 76
5
votes
3 answers

Using PolicyKit to allow non-root users to start and stop a service

I have a requirement to allow non-root users to start and stop a service. It was recommended to me to use PolicyKit rather than sudoers.d, which I am familiar with. As I have no experience with PolicyKit, I thought I would experiment and create a…
PCL
  • 421
  • 2
  • 7
  • 15
3
votes
1 answer

How to create files with root privileges using C++/Qt and PolKit-Qt-1

I apologize for the somewhat lengthy discussion. Also, this is my first submission to StackOverflow, so please forgive my unfamiliarity. I usually use C++/Qt Widget or C++/QML with Linux. This time, I need to create or write files with root…
presire
  • 71
  • 1
  • 5
3
votes
1 answer

polkit-0.113-r0 do_configure: Function failed: do_configure

building policy kit (polkit : present in meta-openembedded [branch : pyro])using yocto and during build getting following error : Log data follows: | DEBUG: SITE files ['endian-little', 'bit-64', 'arm-common', 'arm-64', 'common-linux',…
2
votes
2 answers

How can I find a specific GID within proc stats using grep and PCRE

I am trying to fix a problematic polkit rule that checks to see if the process that is asking for permission is running with specific group ID. The way its being done in the script (not mine) is using a pcre regex to scrape the GID out of the…
AtomicPorkchop
  • 2,625
  • 5
  • 36
  • 55
2
votes
0 answers

Starting systemd services using dbus without root

I've made this polkit rule: polkit.addRule(function(action, subject) { if (action.id == "org.freedesktop.systemd1.manage-units") { return "yes"; } }); It works with the command below, I don't need to be root to start/stop. busctl…
devin
  • 6,407
  • 14
  • 48
  • 53
2
votes
1 answer

How to request serial port permissions with polkit on Linux?

I'm writing a cross-platform app that I would like to run on Linux-based operating systems like Fedora and Ubuntu. I use QSerialPort and it works fine. I can use QSerialPortInfo to get a list of serial ports in the system and present them to the…
Venemo
  • 18,515
  • 13
  • 84
  • 125
1
vote
1 answer

awesome-wm polkit authentication agent?

Polkit authentication agent on awesome-wm? I have problems when opening balenaEtcher for usb-flashing. It instantly gives me an error saying: "No polkit authentication agent found" My questions now is, which polkit-aa should be installed when using…
NoteFox
  • 33
  • 5
1
vote
1 answer

Is there any way to run "pkexec" from a docker container?

I am trying to set up a Docker image (my Dockerfile is available here, sorry for the french README: https://framagit.org/Gwendal/firefox-icedtea-docker) with an old version of Firefox and an old version of Java to run an old Java applet to start a…
Gwendal
  • 490
  • 3
  • 13
1
vote
2 answers

How to set a polkit rule to lock shutdown if a file exists?

I'm writing an application to control the system shutdown if a pendrive is connected to the system. When pendrive is connected, It writes its identifier in a file. If pendrive is disconnected, it remove its identifier of the file and, after this, if…
AlmuHS
  • 387
  • 6
  • 13
0
votes
0 answers

Using `pkexec` for escalation in a snap?

I am writing a GTK gui in Python and I have this line subprocess.run("pkexec (some command)", shell=True) which I have attached to a button in my GUI, but when I try to use the button I get this error /bin/sh:1:pkexec:not found The GUI relies on…
shadeyg56
  • 74
  • 4
0
votes
1 answer

Python - Use pkexec only one time in subprocess.run one time for multiple commands

I need to use two commands requiring privileges and for this reason I'm using pkexec. My piece of code is: def __init__(self): self.__binary = "/usr/bin/docker" self.docker_start = subprocess.run(["pkexec", "systemctl", "start", "docker"],…
Develobeer
  • 425
  • 1
  • 8
  • 19
0
votes
1 answer

Ask for authentication when calling a DBus method on a non-root, other user's daemon

I have a little DBus-activated daemon that registers itself in the system bus but runs as the GDM user (the idea is to allow to set dconf settings and other things from a normal user), and it works fine. The point is that I want to restrict the…
Rastersoft
  • 114
  • 1
  • 6
0
votes
1 answer

Use os.execvp() to call Python script (with Tkinter based GUI) via pkexec and setting environment variables before

This is a follow-up question of Use tkinter based PySimpleGUI as root user via pkexec. I have a Python GUI application. It should be able to run as user and as root. For the latter I know I have to set $DISPLAY and $XAUTHORITY to get a GUI…
buhtz
  • 10,774
  • 18
  • 76
  • 149
0
votes
0 answers

Use tkinter based PySimpleGUI as root user via pkexec

I want to show a GUI Window (PySimpleGUI which is based on tkinter) as root user. I'm using pkexec for that. Using GNU/Linux Debian stable. But I got the error no display name and no $DISPLAY environment variable I understand that a bit. But I…
buhtz
  • 10,774
  • 18
  • 76
  • 149
1
2