LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Laptop and Netbook (https://www.linuxquestions.org/questions/linux-laptop-and-netbook-25/)
-   -   pm-suspend as nonroot (https://www.linuxquestions.org/questions/linux-laptop-and-netbook-25/pm-suspend-as-nonroot-786785/)

neilthereildeil 02-03-2010 04:41 PM

pm-suspend as nonroot
 
Hi. I have a nonroot user and i want to be able to suspend the system as that user. i dont want to have to type the root password or sudo everytime i suspend, because i do this multiple times in a day.when i try to suspend, i get the following error:

/usr/sbin/pm-suspend
This utility may only be run by the root user.

does anyone know how to allow a nonroot user to run this without having to sudo etc? thanks.

Simon Bridge 02-03-2010 11:13 PM

Depending on your distro, you should be able to suspend from the shutdown menu.

You can set up a sudoer (/etc/sudoers) who can run the command, and only that command, as root. Then set up a launcher so you don't have to type the command in every time either.

jschiwal 02-03-2010 11:30 PM

Does your system use policy-kit. Try "polkit-auth --user <username> --show-obtainable". Does it have an entry dealing with suspending?

It used to be the case that programs like this were made suid root to enable regular users to run them. However this usually leaves a dangerous hole. Linux has moved from setting the suid bit --> to udev changing group ownership or permissions on devices --> to policy kit --> to where most of my old polkit rules have gone (session kit / dbus)?

Now you need to use your desktop environment configuration tools to make certain you do something like this properly. A client/server approach is now most common. The desktop communicates the request through dbus. The system determines whether you are authorized to do it and carries it out for you.

Look in the "users & groups" or "security section" configuration section for your distro. That is usually where these type of permissions are made. It could also be a matter of the feature not being enabled. Look at your desktop power management control as well.

If you didn't create a swap partition as large as your memory, you won't be able to suspend your machine. The swap partition is the resume device. It needs to be as large as your memory to be able to dump the memory info there.

neilthereildeil 02-04-2010 11:37 PM

by the way, im running gentoo linux.


All times are GMT -5. The time now is 11:21 PM.