Running 'dd' command at startup?

Posted by Usman Ajmal on Super User See other posts from Super User or by Usman Ajmal
Published on 2010-04-15T09:39:07Z Indexed on 2010/04/15 9:43 UTC
Read the original article Hit count: 197

Filed under:
|
|
|

Hi, I have set a script to run at Linux startup. The script contains a following line of code

dd if=/dev/sda2 of=/dev/sda5 ?> result.txt

Now, when my Linux Desktop appear, result.txt contain

dd: opening '/dev/sda2': Permission denied

If I prefix the dd command with sudo as:

sudo dd if=/dev/sda2 of=/dev/sda5 ?> result.txt

the result.txt contains

sudo: no tty present and no askpass program specified

Is there a way I can get around this problem? What I want is to copy 2nd parititon to 5th when a user logs in no matter if he is root, admin, Desktop or an unprivileged user.

Thanks a lot as always.

© Super User or respective owner

Related posts about linux

Related posts about bash