command on startup ask for admin password

0

1

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>

Fabio

Posted 2017-08-21T04:03:07.537

Reputation: 1

You need to be more specific. What command do you launch at startup. Can you show your script? Welcome at superuser.com! – wp78de – 2017-08-21T04:17:53.770

Good suggestion, I have just added the plist file content – Fabio – 2017-08-21T14:11:00.683

Answers

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

calebx

Posted 2017-08-21T04:03:07.537

Reputation: 1

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 – 2017-08-21T14:08:42.673