If you try to sudo your way through a command with pipes and/or redirects, part of the sequence of commands may be producing sudo-read/writeable streams of data or data objects, which the other parts of the sequence can’t use because they were spawned by your shell and not root.

The solution is to embed the appropriate part of the command in quotes. Like this.

And here is the latest LJ video: The Find Command.


  1. #1 D. C. Sessions
    March 31, 2009

    I love find — but then again, I liked APL, too. They have a lot in common.

  2. #2 Wayne Conrad
    April 1, 2009

    I have always wanted to know how to make sudo do that. Great link.

  3. #3 egaeus
    April 4, 2009

    I find that the easiest way to get around issues with sudo is sudo passwd root. I’m old school like that. 🙂