I currently have a task that adds a grub password so if the user wants to change anything in grub they have to enter the proper user and password.
The problem is that I have it working only when I generate the password by hand using grub-mkpasswd-pbkdf2 enter the password twice, which generates the hash. I then paste the hash into the variable “grub_password”.
The problem is I want to generate a random grub password on the fly and pass this password to grub-mkpasswd-pbkdf2 to generate the hash, then put the hash into a variable. I cannot figure out how to do this. Do I have to use the expect module to feed the random generated password into grub-mkpasswd-pdkdf2?
I’ve scoured online but everyone seems to have generated the hash beforehand. Any ideas how I can do this?