Re: /sys/power/state question with sudoers!
Le Sunday 19 August 2007 11:08:42 Gilles Mocellin, vous avez écrit :
> Le Sunday 19 August 2007 01:00:16 Andrei Popescu, vous avez écrit : > > On Sat, Aug 18, 2007 at 03:35:05PM -0500, Gnu_Raiz wrote: > > > cat sudo_file > > > # /etc/sudoers > > > # > > > # This file MUST be edited with the 'visudo' command as root. > > > # > > > # See the man page for details on how to write a sudoers file. > > > #Defaults env_reset > > > > > > # Host alias specification > > > > > > # User alias specification > > > > > > # Cmnd alias specification > > > > > > # User privilege specification > > > > > > root ALL=(ALL) ALL > > > > > > xxxx xxxx=NOPASSWD: /bin/echo, /sbin/*, /sys/power/state > > > > ^^^^ ^^^^^^^^^^^^^^^^ > > I assume this is your hostname. | > > > > As I understand it, sudo provides access to commands, not files. > > > > > Here is the script I am trying to setup. > > > #!/bin/bash > > > > > > #This is a shell script for hibernation. > > > > > > sudo echo disk >/sys/power/state > > > > ^^^^ > > It should work like this, but maybe you should try replacing it with > > '/usr/bin/echo' > > > > HTH,
> > Andrei
>
> The redirection ">" is not taken by sudo.
>
> For this only reason, I sometime must log as root. Try "sudo -s" then "echo> disk >/sys/power/state" and then exit.
I've just read the manpage of sudo, and here's what it says :
To make a usage listing of the directories in the /home partition. Note that
this runs the commands in a sub-shell to make the cd and file redirection
work.
$ sudo sh -c "cd /home ; du -s * â sort -rn > USAGE"
So, you can do it in on command, sudo is lauching a shell, which is
responsible of redirections, pipes, chaining commands...
--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Received on Sun Aug 19 05:36:39 2007
This archive was generated by hypermail 2.1.8
: Sun Oct 07 2007 - 02:26:00 EDT
|