title: airflow user impersonation (run_as_user) not working
body: <p>I am trying to use run_as_user feature in airflow for our DAG and we are facing some issues. Any help or recommendations?</p>
  
  <pre><code>DAG Code:from datetime import datetime, timedelta
  from airflow import DAG
  from airflow.operators.bash_operator import BashOperator
  current_time = datetime.now() - timedelta(days=1)
  default_args = {
      'start_date': datetime.strptime(current_time.strftime('%Y-%m-%d %H:%M:%S'),'%Y-%m-%d %H:%M:%S'),
      'run_as_user': 'airflowaduser',
      'execution_timeout': timedelta(minutes=5)
  }
  dag = DAG('test_run-as_user', default_args=default_args,description='Run hive Query DAG', schedule_interval='0 * * * *',)
  hive_ex = BashOperator(
      task_id='hive-ex',
      bash_command='whoami',
      dag=dag
  )
  </code></pre>
  
  <p>i have airflow added to sudoers and it can switch to airflowaduser without password from Linux shell.</p>
  
  <p><code>airflow ALL=(ALL) NOPASSWD: ALL</code></p>
  
  <p>Error details below while running the DAG: </p>
  
  <pre><code>*** Reading local file: /home/airflow/logs/test_run-as_user/hive-ex/2020-06-09T16:00:00+00:00/1.log
  [2020-06-09 17:00:04,602] {taskinstance.py:620} INFO - Dependencies all met for &lt;TaskInstance: test_run-as_user.hive-ex 2020-06-09T16:00:00+00:00 [queued]&gt;
  [2020-06-09 17:00:04,613] {taskinstance.py:620} INFO - Dependencies all met for &lt;TaskInstance: test_run-as_user.hive-ex 2020-06-09T16:00:00+00:00 [queued]&gt;
  [2020-06-09 17:00:04,613] {taskinstance.py:838} INFO - 
  --------------------------------------------------------------------------------
  [2020-06-09 17:00:04,613] {taskinstance.py:839} INFO - Starting attempt 1 of 1
  [2020-06-09 17:00:04,613] {taskinstance.py:840} INFO - 
  --------------------------------------------------------------------------------
  [2020-06-09 17:00:04,651] {taskinstance.py:859} INFO - Executing &lt;Task(BashOperator): hive-ex&gt; on 2020-06-09T16:00:00+00:00
  [2020-06-09 17:00:04,651] {base_task_runner.py:133} INFO - Running: ['sudo', '-E', '-H', '-u', 'airflowaduser', 'airflow', 'run', 'test_run-as_user', 'hive-ex', '2020-06-09T16:00:00+00:00', '--job_id', '2314', '--pool', 'default_pool', '--raw', '-sd', 'DAGS_FOLDER/test_run-as_user/testscript.py', '--cfg_path', '/tmp/tmpbinlgw54']
  [2020-06-09 17:00:04,664] {base_task_runner.py:115} INFO - Job 2314: Subtask hive-ex sudo: airflow: command not found
  [2020-06-09 17:00:09,576] {logging_mixin.py:95} INFO - [[34m2020-06-09 17:00:09,575[0m] {[34mlocal_task_job.py:[0m105} INFO[0m - Task exited with return code 1[0m
  </code></pre>
  
  <p>And our airflow runs in virtual environment. </p>