Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • 1
    Thanks, and I found this answer from another question here (edited my question to reflect). So I'll mark your answer, but I'm just curious..and I guess maybe this is a question of philosophy or something..but do you know why sudo doesn't extend to the redirect? Seems to me it logically should...but I'm sort of a noob at CLI so maybe (likely) I'm not seeing the bigger picture Commented Mar 15, 2013 at 14:54
  • 2
    I already answered exactly that. >>file is a shell feature not a general feature thus is cannot be passed as an argument. The shell forks, redirects I/O and then tries to execute the external command. In your case the redirection fails thus calling sudo is not even tried. SUID rights are relevant only when e.g. files are opened. But most programs don't open /dev/stdout: They simply inherit it from their parent. So it's the parent's access rights which determine the possible redirections. Commented Mar 15, 2013 at 15:10
  • 2
    @CrayonViolent sudo doesn't see the redirect, it is handled by the shell. This design decisions allows redirection for any program without a need for modification/support by the program. Commented Mar 15, 2013 at 15:10
  • oh okay sorry, your additional explanations helped clarify it to me. thanks! Commented Mar 15, 2013 at 15:16