0

I have written a plist so that launchctl runs a specific command at startup. I works as expected, except by the fact that it asks me for the admin password which I would like not to have to write it. Does anyone know how to keep it from asking me the admin password?.

It is my personal macbook so I know the admin password and have full access over the machine.

My plist file is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>veracrypt_auto_mount</string> <!-- org.mongodb.mongodb perhaps? -->

<key>OnDemand</key>
<false/>

<key>UserName</key>
<string>fabio</string>

<key>GroupName</key>
<string>admin</string>

<key>ProgramArguments</key>
<array>
        <string>/Applications/VeraCrypt.app/Contents/MacOS/VeraCrypt</string>
        <string>--mount</string>
        <string>/dev/disk0s7</string>
        <string>/Volumes/Veracrypt</string>
        <string>--password=XXXXXX</string>
</array>

  • You need to be more specific. What command do you launch at startup. Can you show your script? Welcome at superuser.com! – wp78de Aug 21 '17 at 4:17
  • Good suggestion, I have just added the plist file content – Fabio Aug 21 '17 at 14:11
0

It might depend on where you put the .plist file and what the permissions on the file are. If you put your .plist file in /Library/LaunchDaemons and give it root permissions, then it will run without user intervention.

From the Terminal (in Applications/Utilities), to give the .plist file the right permissions:

sudo chown root:wheel yourfile.plist

Caveats: using sudo will require your password; make sure the .plist file is actually in /Library/LaunchDaemons

  • Ok, I have added my plist to the question to make things easier. If I am not mistaken in the plist it is shown that the owner was already root. The file was in /Library/LaunchAgents. So I have tried to move it to /Library/LaunchDaemons and it has not mounted anything nor even asked for my password. In addition when it is located at /Library/LaunchAgents a dialog box stating that the volume has been mounted prompts constantly, which is really annoying. – Fabio Aug 21 '17 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.