title: Run daemon as another user on mac os x
body: <p>I'm trying right now to create separate user for jenkins on Mac Os and run it with this user.
  I've created a new user:</p>
  
  <pre><code># Create the group
  sudo dscl . create /Groups/jenkins
  sudo dscl . create /Groups/jenkins PrimaryGroupID 300
  # Create the user
  sudo dscl . create /Users/jenkins
  sudo dscl . create /Users/jenkins PrimaryGroupID 300
  sudo dscl . create /Users/jenkins UniqueID 300
  sudo dscl . create /Users/jenkins UserShell /bin/bash
  # Set the users pasword
  sudo dscl . passwd /Users/jenkins 123qweASD
  # Add the user to the group
  sudo dscl . append /Groups/jenkins GroupMembership jenkins
  </code></pre>
  
  <p>And the I try to run jenkins as jenkins user:</p>
  
  <pre><code>sudo su - jenkins -c run_jenkins.sh
  </code></pre>
  
  <p>and got an error:</p>
  
  <pre><code>su: no directory
  </code></pre>
  
  <p>after I created directory for jenkins user:</p>
  
  <pre><code>sudo dscl . -create /Users/jenkins NFSHomeDirectory /Users/jenkins
  </code></pre>
  
  <p>followed next error:</p>
  
  <pre><code>su: unknown login: jenkins
  </code></pre>
  
  <p>General quiestion:</p>
  
  <ol>
  <li>How can I create an _www like user for a daemon, without home directory i.e.</li>
  <li>How can I run a script as this new user.</li>
  </ol>
  
  <p>Thanks for help!</p>