Using sed to input a grub MD5 bootloader password

226 views Asked by At

I am having issues using sed injecting a password into the grub.conf file.

Here is the syntax I am using:

sed -i /^timeout/s/$/"\npassword -md5 $1$ctuLL1$V4DZinO.4eTYjsGXOfU1F/" /boot/grub/grub.conf

Grub MD5:

$1$ctuLL1$V4DZinO.4eTYjsGXOfU1F/

Thanks for looking!

1

There are 1 answers

0
AudioBubble On

What I used seems to be working:

sed -i -e 's/timeout=5/timeout=0\'$'\npassword --md5 blah/g' /boot/grub/grub.conf

It is how I'm injecting a password during cobbler provisioning.

Obviously, you'll have to escape any special characters in the MD5 hash otherwise sed will complain.