Hi everyone! Hope someone can help:
I want to write a script to disable the EFI password. I could use the jamf binary, I know, but I want the script to work even on machines without the jamf binary.
I wanted to ask, how can I perform a command and send the needed password (in this case, the firmwarepassword) with the command, so there would be no prompt in the Terminal?
This is the current state of the script:
#!/bin/sh
#This discovers the current user, needed for the osascript commands
currentuser=`stat -f%Su /dev/console`
#This prompts the user to enter the EFI-Password
read -r -d '' password <<'EOF'
set dialogText to text returned of (display dialog "Please enter the EFI Password to disable it:" default answer "" with hidden answer)
return dialogText
EOF
efi=$(sudo -u $currentuser /usr/bin/osascript -e "$password");
echo $efi | sudo -S firmwarepasswd -verify
exit 0
With the last line I tried to give the efi-password to the "firmwarepasswd -verify" command, but as it not worked out, I think this is completely wrong..
And the "-verify" is only now for testing, I know the correct option would be "-delete"
Thanks for any input!