| Author |
Allow any user to put machine in standby
|
|
| Robert McDonald 2007-01-12, 7:13 pm |
| As root, I can successfully put my machine in standby mode with
"echo mem > /sys/power/state"
I realize that this isn't robust, but it works for me. (The hibernate
command does not work -- it reports being unable to unload certain modules.)
Anyway, I would like to allow users other than root to execute a script
that contains this command, so that others can put the machine to sleep.
How should I approach this? I tried using visudo to edit sudoers but
couldn't get it to work. Any thoughts?
This is running Debian etch. Thanks!
| |
| J.O. Aho 2007-01-12, 7:13 pm |
| Robert McDonald wrote:
> As root, I can successfully put my machine in standby mode with
>
> "echo mem > /sys/power/state"
>
> I realize that this isn't robust, but it works for me. (The hibernate
> command does not work -- it reports being unable to unload certain
> modules.)
You could always rebuild the kernel and enable "force unload" option for
modules. But of course you never know how the machine will be when it comes
out of hibernation.
--
//Aho
| |
| R McDonald 2007-01-12, 7:13 pm |
| J.O. Aho wrote:
> You could always rebuild the kernel and enable "force unload" option for
> modules. But of course you never know how the machine will be when it
> comes out of hibernation.
>
I'm hesitant to do something like that given my limited knowledge of
linux internals. I imagine there's a reason that the modules don't want
to unload (possibly hibernate thinks there is some potential problem
restoring them when the machine comes out of standby).
| |
| J.O. Aho 2007-01-12, 7:13 pm |
| R McDonald wrote:
> J.O. Aho wrote:
>
> I'm hesitant to do something like that given my limited knowledge of
> linux internals. I imagine there's a reason that the modules don't want
> to unload (possibly hibernate thinks there is some potential problem
> restoring them when the machine comes out of standby).
I could think that the module is required by another module, which isn't
automatically unloaded by the hibernation mechanism. Removing those modules
that does depend on the module that hibernation want to remove, could make the
whole work.
You can use lsmod to see what modules are loaded and if they depend on another
module.
--
//Aho
| |
| Mumia W. (NOSPAM) 2007-01-13, 7:13 am |
| On 01/12/2007 04:25 PM, Robert McDonald wrote:
> As root, I can successfully put my machine in standby mode with
>
> "echo mem > /sys/power/state"
>
> I realize that this isn't robust, but it works for me. (The hibernate
> command does not work -- it reports being unable to unload certain
> modules.)
>
> Anyway, I would like to allow users other than root to execute a script
> that contains this command, so that others can put the machine to sleep.
> How should I approach this? I tried using visudo to edit sudoers but
> couldn't get it to work. Any thoughts?
>
> This is running Debian etch. Thanks!
-----------/usr/local/bin/gostandby----------
#!/bin/sh
echo mem > /sys/power/state
----------/etc/sudoers-------------
# Put users who should be able to put the system
# into standby into the POWER group.
User_Alias POWER = robert
POWER ALL= /usr/local/bin/gostandby
----------end--------
Hope This Helps (HTH)
(Newsgroups trimmed to alt.os.linux.debian)
--
Windows Vista and your freedom in conflict:
http://www.regdeveloper.co.uk/2006/..._eula_analysis/
| |
| R McDonald 2007-01-13, 7:13 pm |
| Mumia W. (NOSPAM) wrote:
> On 01/12/2007 04:25 PM, Robert McDonald wrote:
> -----------/usr/local/bin/gostandby----------
> #!/bin/sh
> echo mem > /sys/power/state
>
> ----------/etc/sudoers-------------
> # Put users who should be able to put the system
> # into standby into the POWER group.
> User_Alias POWER = robert
> POWER ALL= /usr/local/bin/gostandby
>
> ----------end--------
Thanks very much. I run into the same problem as with my previous
attempt, which is that I don't have permission to execute the second
line (echo ...) of the file:
bash: /sys/power/state: permission denied
I tried inserting a chmod, but that didn't work (as I assumed it
wouldn't). I'm not sure what to try next.
| |
| R McDonald 2007-01-13, 7:13 pm |
| Mumia W. (NOSPAM) wrote:
>
> -----------/usr/local/bin/gostandby----------
> #!/bin/sh
> echo mem > /sys/power/state
>
> ----------/etc/sudoers-------------
> # Put users who should be able to put the system
> # into standby into the POWER group.
> User_Alias POWER = robert
> POWER ALL= /usr/local/bin/gostandby
>
> ----------end--------
>
Thanks very much. I run into the same problem as with my previous
attempt, which is that I don't have permission to execute the second
line of the file:
bash: /sys/power/state: permission denied
I tried inserting a chmod, but that didn't work (as I assumed it wouldn't).
| |
| R McDonald 2007-01-13, 7:13 pm |
| Mumia W. (NOSPAM) wrote:
>
> -----------/usr/local/bin/gostandby----------
> #!/bin/sh
> echo mem > /sys/power/state
>
> ----------/etc/sudoers-------------
> # Put users who should be able to put the system
> # into standby into the POWER group.
> User_Alias POWER = robert
> POWER ALL= /usr/local/bin/gostandby
>
> ----------end--------
>
Thanks very much. I run into the same problem as with my previous
attempts, which is that I don't have permission to execute the "echo"
command:
bash: /sys/power/state: permission denied.
I tried inserting a chmod into the script, but that didn't work (as I
assumed it wouldn't.
| |
| R McDonald 2007-01-14, 7:13 pm |
| J.O. Aho wrote:
> R McDonald wrote:
>
> You can use lsmod to see what modules are loaded and if they depend on
> another module.
>
Thanks, lsmod is a good suggestion.
|
|
|
|