Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been working with making custom bootloader and kernel code (not necessarily Linux kernel). I'm putting the images on USB, and was using dd to place them on the sector they needed to be on, and I'm getting tired of burning the image to /dev/sda instead of /dev/sdb (effectively destroying my hard drive).

So I was wondering if I could somehow give user access to the 'dd' command, but only to the /dev/sdb drive, so that if I accidentally type /dev/sda it won't let me, because I wouldn't have run the command as sudo or root.

share|improve this question
up vote 0 down vote accepted

you can make a dd wrapper script that uses sudo, which will only take your bootloader file. that way, you're not likely to make errors if you just keep using your script.

i'm not sure it's worth it to do it using real permissions.

sample script:

sudo dd bs=4K count=1 if=$1 of=/dev/sdb
share|improve this answer
Thats actually a much better idea, it never occurred to me. – John Mar 25 '12 at 0:11
You can then control permissions on the script if for some reason you needed to do that. sudo can also be told what programs certain unprivileged users can run if you are interested. – Huckle Mar 25 '12 at 4:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.