Allow any user to put machine in standby
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Debian support > Linux Debian support > Allow any user to put machine in standby




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Allow any user to put machine in standby  
Robert McDonald


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-13-07 12:13 AM

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!





[ Post a follow-up to this message ]



    Re: Allow any user to put machine in standby  
J.O. Aho


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-13-07 12:13 AM

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





[ Post a follow-up to this message ]



    Re: Allow any user to put machine in standby  
R McDonald


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-13-07 12:13 AM

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).









[ Post a follow-up to this message ]



    Re: Allow any user to put machine in standby  
J.O. Aho


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-13-07 12:13 AM

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 t
he
whole work.

You can use lsmod to see what modules are loaded and if they depend on anoth
er
module.


--

//Aho





[ Post a follow-up to this message ]



    Re: Allow any user to put machine in standby  
Mumia W. (NOSPAM)


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-13-07 12:13 PM

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/





[ Post a follow-up to this message ]



    Re: Allow any user to put machine in standby  
R McDonald


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-14-07 12:13 AM

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.










[ Post a follow-up to this message ]



    Re: Allow any user to put machine in standby  
R McDonald


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-14-07 12:13 AM

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).






[ Post a follow-up to this message ]



    Re: Allow any user to put machine in standby  
R McDonald


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-14-07 12:13 AM

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.





[ Post a follow-up to this message ]



    Re: Allow any user to put machine in standby  
R McDonald


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-15-07 12:13 AM

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.








[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 12:58 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register