Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Got it!

(root)

read line < mypipe
date -s $line

Thank you everybody! ;)

share|improve this answer
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 1:18

Why not give the user access to date via sudo ?

share|improve this answer
    
busybox doesn't support sudo (at least the version I'm using). –  michelemarcon Dec 28 '10 at 16:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.