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-files
So I cd
to that directory and run
sudo md5sum my.iso > my.iso.md5
and I get the following error:
bash: my.iso.md5: Permission denied
I 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?
sudo bash -c ""
command... +1 – Izkata Dec 21 '11 at 15:40tee
, note that this will also print the contents to the console, and so shouldn't be used on binary or untrusted inputs. – Shelvacu May 05 '16 at 20:39