1 |
I am trying to create a script so users can execute a certain command as root |
2 |
without entering a password. I thought suid was the way to do this, but I am |
3 |
not having any success. |
4 |
|
5 |
The command I want to execute as root is "echo -n mem > /sys/power/status". |
6 |
|
7 |
I created a bash script (/usr/local/bin/suspendtoram) like so: |
8 |
|
9 |
#!/bin/bash |
10 |
echo -n mem > /sys/power/status |
11 |
|
12 |
then set owner and group to root:root and made the script suid. |
13 |
|
14 |
However this doesn't work. The error message goes: |
15 |
|
16 |
/usr/local/bin/suspendtoram: line 2: /sys/power/state: Permission denied |
17 |
|
18 |
|
19 |
I am still having to "sudo echo -n mem > /sys/power/status" and then to enter |
20 |
a password. What am I doing wrong? |
21 |
|
22 |
thanks |
23 |
Robert |
24 |
-- |
25 |
Robert Persson |
26 |
|
27 |
Conspiracy Bears: |
28 |
Once upon a time there were lots of conspiracy bears... |
29 |
|
30 |
-- |
31 |
gentoo-user@g.o mailing list |