[mythtv-users] How do I use sudo to write to a root-owned file?

Nicholas Meyer npmeyer at gmail.com
Sun Oct 11 12:49:59 UTC 2009

On Sat, Oct 10, 2009 at 11:16 AM, Craig Huff <huffcslists at gmail.com> wrote:
> I am constantly amazed at the depth of my ignorance.  Sigh...
> I am trying to run a script invoked by mythshutdown (running as lowly
> user mythtv, uid 104 FWIW) which needs to write values to
> /sys/class/rtc/rtc0/wakealarm in order to set the time the system
> should wake up.  Is there a more direct way to accomplish this than to
> create a script just for this and use sudo to invoke the script?
> Craig.

Hi Craig,

You can accomplish this by echoing the values and piping the output of
the echo into a "sudo tee" command:

echo "values" | sudo tee /sys/class/rtc/rtc0/wakealarm > /dev/null

Thank the Wikipedia page for 'tee' (
http://en.wikipedia.org/wiki/Tee_(command) )

~ Nick

More information about the mythtv-users mailing list