title: Fabric 3 ask sudo password once
body: <p>I am using fabric to automate some deployment stuff. Below is a sample of the code I used: </p>
  
  <pre><code>run(f"sudo -H -u www-data bash -c 'rm -r project_name' ")
  run(f"sudo -H -u www-data bash -c '/opt/www-data/project-name/bin/pip install -r requirements.txt' ")
  
  run("sudo systemctl stop gunicorn")
  run("sudo systemctl start gunicorn")
  </code></pre>
  
  <p>Everytime each line of code was ran, the terminal ask for my user password, is there a way I can enter the password just once?</p>
  
  <p>Edit:
  I am using python3 and the essence of the script was to run the commands on a different user, rather than my own.</p>
  
  <p>Update:</p>
  
  <p>I achieved this by running fabric with "-I" param.</p>
  
  <pre><code>fabric -I deploy
  </code></pre>