-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or request
Description
From #131:
On some linux distros (e.g. Raspbian 12 Bookworm) poweroff --wtmp-only does not fail as expected, and wrong command is selected for reboot and poweroff.
TODO:
- Make the power commands editable, e.g.
poweroffis the default, but user can change it manually tosudo poweroffor whatever they like. Current methods can be used to select the defaults on Linux. - Documentation: Recommend users to add a polkit rule instead of updating a sudoers file. This way IoTuring can call power commands without sudo. E.g.
/etc/polkit-1/rules.d/49-power-nopasswd.rulesfor userpi:
polkit.addRule(function(action, subject) {
if ((action.id == "org.freedesktop.login1.reboot-multiple-sessions" ||
action.id == "org.freedesktop.login1.power-off-multiple-sessions" ) &&
subject.user == "pi")
{
return polkit.Result.YES;
}
});On an automatic installation this should be placed in /usr/share/polkit-1/rules.d instead of /etc. It's much safer to edit this, recently messed up my sudoers and it was not easy to get back control.
- @richibrics Does something similar exist on macos? Something more modern and fine-grained than editing the sudoers file?
- Quick search says running
osascript -e 'tell application "System Events" to shut down'and similar commands work without sudo Source
Maybe they could be the defaults, andd users can manually change them to the sudo version if they set up sudoers?
- Quick search says running
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or request