HOW-TO? Stdout redirect

Emil Isberg emil.isberg at
Mon Mar 13 22:30:53 EST 2000

On Mon, 13 Mar 2000, Tom McGivern wrote:
>Ok.. color me stupid... I've tried several, what I thought Obviuos,
>variations.. but I can't manage to redirect stdout as the target user.

You're not stupid. You just don´t see the forest for all the trees... ;-)

>$ sudo echo hello > there
>-- Shell complains I don't have write access to "there"
>(the shell only sends "echo hello" to sudo)

Redirection is as you say part of the shell so if you should be able you
must let sudo start a shell for you.

How do one say to a (bourne)shell that it should execute something like
Well the argument -c is quite helpful:
$ sudo sh -c 'echo hello > there'

The rest you'll figure out...

I Know A Joke

More information about the sudo-users mailing list