I am trying to run Rscript
as a different user under constrained environment with a user which do not have the access to /tmp
.
As the Rscript
create a tmp file, it needs access to /tmp
. So i thought if i can tell Rscript
to change the tmp directory and user the one i specify.
In the documention it is mentioned that Rscript
looks at the $TMPDIR
environment variable to set its tmp
directory
Below are all the failed trails to pass the environment variable.
ATTEMPT-1: runuser -l MYUSER -c "export TMPDIR=/SOME_DIR && 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 " --> Random stuff
All attempt failed.
I cannot move away from runuser
.
Any help will be appreciated