How to suspend and hibernate as a regular user
Published: Sunday, May 12, 2019
If you use a Linux distribution that uses an init system other than systemd with the suspend and/or hibernate feature, chances are that you use
pm-utils for it.
You then also know that you need to use
sudo for it to work. This is a bit of an issue if you want to bind either command to a keyboard shortcut. A way around this is to add an exception for
pm-hibernate in the your
/etc/sudoers file, so you don’t have to enter your password for them anymore.
Just open your configuration for
sudo with the command
visudo and add this:
<USER> ALL = NOPASSWD: /usr/sbin/pm-hibernate <USER> ALL = NOPASSWD: /usr/sbin/pm-suspend
You still need to use
sudo pm-suspend and
sudo pm-hibernate, but it will no longer ask you for your password.
If you want to leave feedback you can do so by sending me a message via e-mail.