title: How to run sudo under su?
body: <p>I have this:</p>
  
  <pre><code>su $username -c ./script.sh
  </code></pre>
  
  <p>The problem is that within script I have 'sudo' commands and they says me</p>
  
  <pre><code>sudo: no tty present and no askpass program specified
  </code></pre>
  
  <p>How to do this right?</p>
  
  <p>UPD: I need both sudo and su. What I need to do is run script as USER $username and be able to run certain commands within script as root (for example, pacman -S)</p>
  
  <p>SOLUTION: I've added NOPASSWD option to /etc/sudoers before running script and delete this entry using sed after script finished.</p>