How can we set environment variables for another user on a machine? I want to run some script with sudo -u xyz
but I need to set some environment variables before running the script for xyz user which is different from my login.
You can add VAR=VALUE between the sudo -u xyz
and the script. Example
sudo -u xyz LANG=C LD_LIBRARY_PATH=/usr/local/lib some_script.sh
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With