How to fix Debian Xfce not sleeping automatically when idle because it asks for root password
To fix this issue, you need to edit two configuration files. You can do that through:
Summary
Graphical interface
1. Using the file manager, navigate to /etc/polkit-1/, right-click the rules.d folder and click Open Folder as Root.
By default, Thunar doesn't show that option to open a folder with root privileges. To add it, read this article.
2. Create a new file named 85-suspend.rules with a text editor like Mousepad.
3. Paste the following text into the text editor and save the file.
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.login1.suspend" &&
subject.isInGroup("users")) {
return polkit.Result.YES;
}
});
4. Right-click the file and click Properties. In the window that opened, click on the Permissions tab and set the permissions as the same as the image below. Then, click Close.
5. Go back one directory, right-click the rules.d folder and click Properties. In the window that opened, click on the Permissions tab and set the permissions as the same as the image below. Then, click Close.
6. Navigate to /usr/share/polkit-1/actions/ and edit the org.xfce.power.policy file with a text editor like Mousepad.
7. Under the section <action id="org.xfce.power.xfce4-pm-helper">, edit the lines <allow_any>auth_admin</allow_any>, <allow_inactive>auth_admin</allow_inactive> and <allow_active>yes</allow_active> changing their values to yes and save it.
8. Restart the computer.
Command-line
1. Create the file /etc/polkit-1/rules.d/85-suspend.rules with a text editor like Nano:
sudo nano /etc/polkit-1/rules.d/85-suspend.rules
2. There, paste the following content and save:
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.login1.suspend" &&
subject.isInGroup("users")) {
return polkit.Result.YES;
}
});
3. Change the permissions of the file and its directory:
sudo chmod 755 /etc/polkit-1/rules.d && sudo chmod 644 /etc/polkit-1/rules.d/85-suspend.rules
4. Edit the file /usr/share/polkit-1/actions/org.xfce.power.policy with a text editor like Nano:
sudo nano /usr/share/polkit-1/actions/org.xfce.power.policy
5. There, under the section <action id="org.xfce.power.xfce4-pm-helper">, edit the lines <allow_any>auth_admin</allow_any>, <allow_inactive>auth_admin</allow_inactive> and <allow_active>yes</allow_active> changing their values to yes and save.
6. Restart the computer.
Knowledge archived from "Authentication required before suspend" and "[SOLVED]Power manager is asking for authentication to perform automatic suspend.", solved by mja and sjm_uk, respectively.