Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: enable dinit shutdown/poweroff/reboot commands for all users (Read 1276 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

enable dinit shutdown/poweroff/reboot commands for all users

Hello, I've recently installed Artix on my old pc with dinit as my init system and dwm as my window manager.

Is there a way to make dinit poweroff/reboot commands executable by normal user?
I want to be able to run them from dmenu, so aliases won't work.

Re: enable dinit shutdown/poweroff/reboot commands for all users

Reply #1
On any init, loginctl poweroff, loginctl reboot, etc. are the go-to answers for performing these without root.

Re: enable dinit shutdown/poweroff/reboot commands for all users

Reply #2
Attempts to call 'loginctl poweroff' return 'Failed to power off system via elogind: Access denied'
I'm not familiar with elogind, so I don't know how to give myself the required permission

Re: enable dinit shutdown/poweroff/reboot commands for all users

Reply #3
I have opendoas set up so it doesn't require password for shutdown and reboot commands. This might not suit your definition of security.

https://git.sr.ht/~strahinja/dwm/tree/master/item/sdmenu

The other solution would be to setuid root the shutdown and reboot executables. Neither solution is ideal, but then again, neither is allowing ordinary user to shutdown or reboot in general. Unix was simply not meant for desktop.

Edit: Disclaimer: I use seatd instead of elogind.

Re: enable dinit shutdown/poweroff/reboot commands for all users

Reply #4
You need to configure polkit properly .

Re: enable dinit shutdown/poweroff/reboot commands for all users

Reply #5
Strajder's sdmenu worked for me, many thanks!