I'm trying to execute a script from a different server using ssh
Here's the command I'm using from server 1 to launch a query on server 2:
ssh -t [email protected] "cd /var/www/vhosts/xxxxx/subdomains/preprod/; sudo ./replace.sh";
but the problem is that when I do sudo
the $home
= /root
while the script is under: /var/www/vhosts/xxxxx/subdomains/preprod/
How can i tell sudo to preserve the environment?
I tried sudo -P -
, sudo -H
, without any luck.
That's what I got from the man page.
sudo -E
-E The -E (preserve environment) option will override the env_reset option in sudoers(5)). It is only available when either the matching command has the SETENV tag or the setenv option is set in sudoers(5).
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