0

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.

1 Answer 1

0

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:

#!/bin/sh
sudo dd bs=4K count=1 if=$1 of=/dev/sdb
2
  • Thats actually a much better idea, it never occurred to me.
    – codesmith
    Mar 25, 2012 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, 2012 at 4:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .