title: How to export Variable when using runuser
body: <p>I am trying to run <code>Rscript</code> as a different user under constrained environment with a user which do not have the access to <code>/tmp</code>.</p>
  
  <p>As the <code>Rscript</code> create a tmp file, it needs access to <code>/tmp</code>. So i thought if i can tell <code>Rscript</code> to change the tmp directory and user the one i specify.</p>
  
  <p>In the documention it is mentioned that <code>Rscript</code> looks at the <code>$TMPDIR</code> environment variable to set its <code>tmp</code> directory</p>
  
  <p>Below are all the failed trails to pass the environment variable.</p>
  
  <pre><code>ATTEMPT-1: runuser -l MYUSER -c "export TMPDIR=/SOME_DIR &amp;&amp; echo $TMPDIR"
  ATTEMPT-2: runuser -l MYUSER TMPDIR=/SOME_DIR -c "echo $TMPDIR"
  ATTEMPT-3: runuser -l MYUSER TMPDIR=/SOME_DIR -c "echo $TMPDIR"
  ATTEMPT-3: runuser -l MYUSER -c "Rscript --TMPDIR=/SOME_DIR test.r "   --&gt; Random stuff
  </code></pre>
  
  <p>All attempt failed.</p>
  
  <p>I cannot move away from <code>runuser</code> .</p>
  
  <p>Any help will be appreciated </p>