This question already has an answer here:
- sudo & redirect output 3 answers
I'me using ubuntu 12.04 lts on usb live stick for backup purposes of my ubuntu hd-installation before updating system. The backup usb-hdd is automounted when hotpluged, it gets something like /media/c614hflk0913135cb14 so i tried to backup the complete hdd using
sudo dd if=/dev/sda | bzip2 > /media/c614hflk0913135cb14/backup/sda.img.bz2
in a terminal window, which produced error message: insufficient privileges to write /media/c614hflk0913135cb14/backup/sda.img.bz2. So I changed the command to
sudo dd if=/dev/sda | sudo bzip2 > /media/c614hflk0913135cb14/backup/sda.img.bz2
since root has sufficient privileges to write files in this folder, I've checked this. But still the error remains, I can't write the file to the usb disk. Does anybody know how to make the pipe work with root privileges?