title: Sudo in Fabric2
body: <p>I would like to reproduce the behavior of my old Fabric1 script running</p>
  
  <pre><code>sudo('useradd -m -u --groups mygroup myuser')
  </code></pre>
  
  <p>In that case the remote machine (an Ubuntu AWS instance) would prompt me for my sudo password and I was able to type it in. Even the repeated prompt after a wrong input would work. After that Fabric1 would hold on to that password by keeping the connection open. </p>
  
  <p>In my new Fabric 2.x script I am using within a @task</p>
  
  <pre><code>c.sudo('useradd -m -u --groups mygroup myuser')
  </code></pre>
  
  <p>I am still getting a user prompt but it does not wait for my response, I am not able to type the password, and it fails as expected with </p>
  
  <pre><code>invoke.exceptions.AuthFailure: The password submitted to prompt '[sudo] password: ' was rejected
  </code></pre>
  
  <p>Using the --prompt-for-sudo-password argument has the same (or no effect).</p>
  
  <p>I also tried</p>
  
  <pre><code>run('sudo useradd -m -u --groups mygroup myuser')
  </code></pre>
  
  <p>and received</p>
  
  <pre><code>sudo: no tty present and no askpass program specified
  </code></pre>
  
  <p>I would preferable not set the askpass program on a machine that worked perfectly without on Fabric 1.x (unless I could do that from my script which would require sudo, I guess).</p>
  
  <p>I have been banging my head against the wall trying to use the complicated and not well documented configuration system but with no success.</p>
  
  <p>What am I missing? If there is extra configuration required, I would like to know the syntax of the config file as well as where to place that file so that it get picked up by the fab CLI command.</p>