launchd UserName key not working So I am trying to write a launchd file to run a script on a Mac Mini as a specific user when they are not logged in. This is the plist file:

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;com.wintr.eodemail&lt;/string&gt;
    &lt;key&gt;Program&lt;/key&gt;
    &lt;string&gt;/Users/*myusername*/Desktop/testdaemon/testdaemon.sh&lt;/string&gt;
    &lt;key&gt;StandardErrorPath&lt;/key&gt;
    &lt;string&gt;/var/log/eod-email.log&lt;/string&gt;
    &lt;key&gt;StandardOutPath&lt;/key&gt;
    &lt;string&gt;/var/log/eod-email.log&lt;/string&gt;
    &lt;key&gt;RunAtLoad&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;StartCalendarInterval&lt;/key&gt;
    &lt;array&gt;
        &lt;dict&gt;
            &lt;key&gt;Minute&lt;/key&gt;
            &lt;integer&gt;20&lt;/integer&gt;
        &lt;/dict&gt;
    &lt;/array&gt;
&lt;/dict&gt;
&lt;/plist&gt;


I have this placed in /Library/LaunchDaemons/ and it works fine running as the root user. Runs exactly when I tell it when no one is logged on, however when I add the UserName key it suddenly stops working:

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;com.wintr.eodemail&lt;/string&gt;
    &lt;key&gt;Program&lt;/key&gt;
    &lt;string&gt;/Users/*myusername*/Desktop/testdaemon/testdaemon.sh&lt;/string&gt;
    &lt;key&gt;StandardErrorPath&lt;/key&gt;
    &lt;string&gt;/var/log/eod-email.log&lt;/string&gt;
    &lt;key&gt;StandardOutPath&lt;/key&gt;
    &lt;string&gt;/var/log/eod-email.log&lt;/string&gt;
    &lt;key&gt;RunAtLoad&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;StartCalendarInterval&lt;/key&gt;
    &lt;array&gt;
        &lt;dict&gt;
            &lt;key&gt;Minute&lt;/key&gt;
            &lt;integer&gt;20&lt;/integer&gt;
        &lt;/dict&gt;
    &lt;/array&gt;
    &lt;key&gt;UserName&lt;/key&gt;
    &lt;string&gt;*myusername*&lt;/string&gt;
&lt;/dict&gt;
&lt;/plist&gt;


When I unload and load the file, then check if it loaded correctly with sudo launchctl list | grep wintr it shows:

-       78      com.wintr.eodemail


And doesn't run. What am I doing wrong here?
As fd0 pointed out, my user could not write to the directory /private/var/log, since I did not need the logs I removed the following lines:

&lt;key&gt;StandardErrorPath&lt;/key&gt;
&lt;string&gt;/var/log/eod-email.log&lt;/string&gt;
&lt;key&gt;StandardOutPath&lt;/key&gt;
&lt;string&gt;/var/log/eod-email.log&lt;/string&gt;


And it started working! I could have also changed these to a directory my user can write to to fix the issue.