I'm making script for Post OS install which will be consisting of setting env for Apps and DB and also will include hardening. Doing this manually is not practical which takes hours when a Bash script can do in seconds.
Now for Hardening part I have to set Grub password.
using sed I use this command
sed -i '/timeout/ a password --md5 "$gpassword"' /boot/grub/grub.conf
also tried
sed -i '/timeout/ a password --md5 `grub_crypt' /boot/grub/grub.conf
But problem is this it just write
password --md5 "$gpassword"
in /boot/grub/grub.conf
Is there a way to overcome this and even a better way