0

I want to let a standard user change the system date.

So I created a named pipe. The standard user write a date to the named pipe and a root process listens to it and sets the date accordingly:

(user)

echo 122515502010 > /tmp/mypipe

(root)

date -s < /tmp/mypipe

Unfortunately this doesn't work. Where am I wrong?

I'm doing this from an embedded Linux (busybox) with bash.

michelemarcon
  • 671
  • 1
  • 7
  • 14

2 Answers2

1

Got it!

(root)

read line < mypipe
date -s $line

Thank you everybody! ;)

michelemarcon
  • 671
  • 1
  • 7
  • 14
  • 1
    As a shortcut, note that `read` will automatically populate `$REPLY` (unless you override the return variable name, as done in your example) – danlefree Dec 29 '10 at 01:18
0

Why not give the user access to date via sudo ?

user9517
  • 115,471
  • 20
  • 215
  • 297