How does sudo handle Pipes?

Tim Olson Tim at
Wed Jan 17 13:33:30 EST 2001

Does anyone have any idea how sudo handles commands that are piped
into other commands?   I'm still working on the password changing
script and decided that I don't know if I want to go with the
expect command.  This would mean that I would have to use something

/bin/echo username:password | /usr/bin/chpasswd 


/bin/echo password | /usr/bin/passwd --stdin username

The commands themselves work, but when I try to run them through
sudo I get errors that indicate the command is not available.  It
seems to break at about the pipe.  Quotes around the command seem
to be ignored.  I just can't come up with a reason why, but I thought
maybe sudo doesn't handle pipes well.

Also, what would 

/bin/sh -c

do for me if I append it to the front of the command?....I've tried
it with and without it with no good results.

Tim Olson - Systems Administrator
Union Semiconductor Technology Corp.
900 Lowater Rd.
Chippewa Falls, WI  54729

mailto:tolson at
Phone: (715) 720-0252  x2010
Cellphone: (715) 828-7106

More information about the sudo-users mailing list