Possible Duplicate:Redirecting stdout to a file you don't have write permission on I'm trying to create an md5sum for an ISO image created with the Ubuntu Customization Kit tools.  The ISO is created by the tools, which have to be run with sudo, in ~/tmp/remaster-new-files/ which has permissions:drwxr-xr-x 2 root root remaster-new-filesSo I cd to that directory and runsudo md5sum my.iso > my.iso.md5and I get the following error: bash: my.iso.md5: Permission deniedI can create the md5 sum somewhere else and use sudo mv to move it into place, exactly where it would be if the sudo md5sum command succeeded.  Also, if I change user to root with sudo su root, I can run the md5sum command successfully.  Why can't I use sudo to create files in this directory, given that I can use sudo to move files to it?
Why can I copy files to, but not create files in, this directory?
permissions;directory;sudo
The problem is that the redirection is done from the shell before running the command, as the current user, so sudo do not come into play.Use insteadmd5sum my.iso | sudo tee my.iso.md5