Linux, plaintext & minimalism

Notice: This blog have moved to hunden.linuxkompis.se. Read more about it here: My blog have a new home and a new address.

May 12, 2019

How to suspend and hibernate as a regular user

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-suspend and 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.

Tags: pm-utils | Suspend | Hibernate


I don't have a commenting system simply because I haven't found a solution that I like. If you want to leave any feedback and/or have any questions, feel free to contact me either via e-mail, fediverse, XMPP or IRC (I'm Hund at freenode.net).