Using Polkit
Add yourself to users group by
sudo usermod -aG users "$USER"
You need to reboot your computer after the following steps.
1. If PolKit version >= 0.106
You can check version of Polkit by: pkaction --version
If PolKit version < 0.106, there are NO .rules files but only old
.pkla and .conf files because those Polkit versions do not have
the Javascript interpreter.
Just adding a file /etc/polkit-1/rules.d/85-suspend.rules with:
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.login1.suspend" &&
subject.isInGroup("users")) {
return polkit.Result.YES;
}
});
And in Terminal, type:
sudo chmod 755 /etc/polkit-1/rules.d
sudo chmod 644 /etc/polkit-1/rules.d/85-suspend.rules
2. If PolKit version < 0.106
In this case, adding a file /var/lib/polkit-1/localauthority/50-local.d/50-enable-suspend-on-lockscreen.pkla with:
[Allow suspending in lockscreen]
Identity=unix-group:users
Action=org.freedesktop.login1.suspend
ResultAny=yes
ResultInactive=yes
ResultActive=yes
In bash, type:
sudo chmod 644 /var/lib/polkit-1/localauthority/50-local.d/50-enable-suspend-on-lockscreen.pkla
More about pklocalauthority
Using Power Manager settings (not sure if it works)
In XFCE Power Manager:
Under the Security tab:
- Set
Automatically lock the session to Never
- Check
Lock the screen when the system is going for sleep
- Under the
Display tab, blank the screen after 15 minutes. Set Sleep
and Switch off times to be disabled (greyed out).
- Under the
System tab, set system sleep mode to Suspend after an half of hour.
References: