I am using tsocks to socksify my connections. When I run the following commands, apt-get isn't socksified:
$ . tsocks -on
$ sudo apt-get update
However, when I run the whole thing in one line like the following, it works.
sudo tsocks apt-get update
I have verified that when I type . tsocks -on, my LD_PRELOAD environment variable is set to /usr/lib/libtsocks.so.
Why doesn't the former work?
sudo -iand thenecho $LD_PRELOAD, and I've gotten nothing. So I assume the variable isn't being set when I run. tsocks -on. How can I make it be set though? – Parham Doustdar Nov 08 '14 at 15:54sudo(look at the -E flag to preserve the environment) or the manpage forsudoersatenv_keep). – Mihai Criveti Nov 08 '14 at 15:58Defaults env_keep += "LD_PRELOAD"to both/etc/sudoers.d/vagrant(the user with which I am sudo-ing) and/etc/sudoers, just beneathDefaults env_reset, but the first command in your first option, and alsosudo printenv LD_PRELOADstill return nothing. – Parham Doustdar Nov 08 '14 at 16:53