On Fri, 27 Jan 2006, Robert Persson wrote:


I created a bash script (/usr/local/bin/suspendtoram) like so:

#!/bin/bash
echo -n mem > /sys/power/status

then set owner and group to root:root and made the script suid.

However this doesn't work. The error message goes:

/usr/local/bin/suspendtoram: line 2: /sys/power/state: Permission denied

suid doesn't work with scripts (for security reasons, although I can't
say I understand what reasons).

I am still having to "sudo echo -n mem > /sys/power/status" and then to enter
a password. What am I doing wrong?

Did you edit /etc/sudoers? Example:
        joeuser ALL = NOPASSWD: /your/command/here
Remember to edit the file with visudo, which will warn you in case you
make a syntax error.

Cheers,

Jorge Almeida
--
gentoo-user@gentoo.org mailing list

Reply via email to