Hello and sorry for my English in advance.
I need to execute from root command like
envVariable1=15 envVariable2=25 sudo -u user1 sudo -E myCommand
but environment variables don't pass to myCommand. This may look illogical, but it's necessary to run command from root and with sudo cause it will be used in scripts. How can I work around the problem?
sudo? What's wrong withenvVariable1=15 envVariable2=25 sudo -E myCommand? If there's a good reason for the the firstsudo, this also needs a-E. Alternatively, if you don't need to preserve other environment variables, add anenvcommand to the finalsudo, as insudo -u user1 sudo env envVariable1=15 envVariable2=25 myCommand. – AFH Oct 25 '16 at 13:59