title: Mac OSX mount smb to /Volumes from script
body: <p>I can mount an smb share to /Volumes using the following</p>
  <pre><code>osascript -e &quot;mount volume \&quot;smb://user:pass@hal/share\&quot;&quot;
  </code></pre>
  <p>But this only works if I have already logged into the Mac, otherwise I get a &quot;FAILED TO establish the default connection to the WindowServer&quot; error.</p>
  <p>I can use the mount command to mount to a folder in my home directory, which works whether or not I have logged in:</p>
  <pre><code>mkdir ~/test
  mount -t smbfs //user:pass@hal/share ~/test
  </code></pre>
  <p>But I can't do this with /Volumes as it is owned by root. How does the osascript call have the permission to write to a folder owned by root and how can I do the same thing without using AppleScript?</p>
  <p>Thank you</p>