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

postscript loses authentication for systemctl commands after suspending #366

Closed
ByteDrummer opened this issue Nov 2, 2023 · 1 comment
Closed

Comments

@ByteDrummer
Copy link

ByteDrummer commented Nov 2, 2023

For testing purposes, I'm relying on the following postscript for the common profile symlinked to default which executes after logging in and resuming from suspend:

#!/bin/bash

echo "running postscript" >> ~/.config/autorandr/test.txt
systemctl suspend &>> ~/.config/autorandr/test.txt

When automatically executed after resuming from suspend, this script gives the following output:

running postscript
Call to Suspend failed: Interactive authentication required.

This is an issue because I use autorandr to run polybar, and polybar to open a rofi power menu with buttons that allow me to suspend, reboot, and power off my computer. Since the rofi power menu is a subprocess of the postscript, none of these menu buttons work because of the lack of permissions.

It's only an issue when the postscript is run automatically after suspending. Furthermore, if I manually execute autorandr --load default I don't encounter this permission issue.

@phillipberndt
Copy link
Owner

You can work around this by prefixing systemctl suspend with sudo and then allowlisting that command for NOPASSWD with visudo.

An alternative is to keep the session in the sudo authentication cache by periodically running sudo -v. I don't know if that survives suspend.

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