<div dir="ltr">Thank you for the answers, I am working on an embedded system and the polkit is not installed (not enabled at all in yocto build).<div>I have a systemd service that run as a normal user and for some use case it requires to do a reboot</div><div>I simulate it just for now as a dbus-send as shown below (just for debug - dbus-send will be replaced by a binary which will do the reboot)</div><div>Previously the guest user was in sudoers (so to run reboot the systemd service uses "sudo") but actually our customer wants to remove the guest user from sudoers.</div><div>Adding capabilities doesn't give me required permissions<br></div><div><br></div><div><i>[Service]<br>User=guest<br>ExecStart=dbus-send --system --print-reply --dest=org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager.StartUnit string:reboot.target string:replace-irreversibly<br>AmbientCapabilities=CAP_SYS_BOOT CAP_SYS_ADMIN<br>CapabilityBoundingSet=CAP_SYS_BOOT CAP_SYS_ADMIN<br></i></div><div><i>[Install]<br>WantedBy=multi-user.target</i><br></div><div><br></div><div></div><div>Thank,</div><div>Mohamed Ali</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mar. 30 nov. 2021 à 10:37, Colin Guthrie <<a href="mailto:gmane@colin.guthr.ie">gmane@colin.guthr.ie</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Mantas Mikulėnas wrote on 30/11/2021 08:42:<br>
> On Tue, Nov 30, 2021 at 10:11 AM Mohamed Ali Fodha <br>
> <<a href="mailto:fodha.mohamed.ali@gmail.com" target="_blank">fodha.mohamed.ali@gmail.com</a> <mailto:<a href="mailto:fodha.mohamed.ali@gmail.com" target="_blank">fodha.mohamed.ali@gmail.com</a>>> wrote:<br>
> <br>
> Hello,<br>
> <br>
> I want to run reboot as normal user using the following command:<br>
> dbus-send --system --print-reply --reply-timeout=2000<br>
> --type=method_call --dest=org.freedesktop.login1<br>
> /org/freedesktop/login1 org.freedesktop.login1.Manager.Reboot<br>
> boolean:false<br>
> <br>
> but I got a Permission denied error.<br>
> <br>
> I checked that verify_shutdown_creds (in logind-dbus.c) calls<br>
> bus_verify_polkit_async, could it be the reason why I got permission<br>
> denied error while polkit is not installed?<br>
> <br>
> <br>
> Yes. Polkit is the authorization system that decides whether to allow <br>
> normal users to do privileged actions or not.<br>
> <br>
> I don't want to use Polkit or sudo, is there any solution ?<br>
> <br>
> No.<br>
<br>
When you say you don't want to use polkit, are you just saying you want <br>
to run dbus-send directly rather than prefixing it with pkexec or that <br>
you really don't want polkit installed at all?<br>
<br>
If you don't mind having polkit installed and configured (doesn't have <br>
to run all the time) then running dbus-send as above will just work as <br>
you want (no need to run it via a pkexec wrapper). That's literally the <br>
job of polkit - to allow certain privileged operations to users.<br>
<br>
If this isn't what you want you'll need to write your own suid wrapper <br>
binary that calls the commands for you.<br>
<br>
Col<br>
<br>
<br>
</blockquote></div>