[CentOS] how to set default proxy?
Les Mikesell
lesmikesell at gmail.com
Sat Oct 31 22:20:27 UTC 2009
Alexander Dalloz wrote:
> Eugeneapolinary Ju schrieb:
>> hi
>>
>>
>>
>> I know that I could use ssh tunneling:
>>
>>
>>
>> ssh -fND localhost:6000 SOMEBODY at 192.168.56.5 -p PORTNUMBER
>>
>>
>>
>> to surf the web through another machines internet connection -> I just need to set Firefox to use proxy 6000.
>>
>>
>>
>> But:
>>
>>
>>
>> How can I set that on the client side, to e.g.: ping through the
>> machine with openssh-server? Not just setting Firefox to use port 6000.
>> Is there any method for setting the default proxy in Linux, so that if
>> I use wget, I will download through the ssh tunnel?
>>
>>
>>
>> Thank you
>
> You can set the proxy parameters within /etc/wgetrc for wget. Or in
> /etc/lftp.conf for lftp.
>
> Generally the system variable is http_proxy and ftp_proxy. Either set
> them globally for all system users i.e. in a file like
> /etc/profile.d/proxy.{csh,sh} or just for your own environment in your
> shell's profile.
>
> export http_proxy=http://username:password@proxy_address:port
> export ftp_proxy=ftp://username:password@proxy_address:port
>
> username and password are optional and depending from your proxy policy
> and settings.
Those settings are for http/ftp proxies (like squid) and are understood
internally by most things that do http or ftp. However, the command above sets
up ssh as a socks proxy, and there is not a generic way to tell things to use
socks proxy in the environment. You either need to configure apps individually
to use a socks proxy or use something like runsocks that pushes a socks-aware
shared library in front of each app.
If there is a squid or similar proxy on the other end of the ssh connection you
could use port-forwarding to it, then export the environment variable settings
pointing to your locally-forwarded port.
--
Les Mikesell
lesmikesell at gmail.com
More information about the CentOS
mailing list