4

Can I configure w3m to use Squid by default when invoked by a specific user in a bash login shell?

I've looked inside the w3m configuration file, but I don't see any setting were I can set squid as the default proxy.

3

You don't tell a browser to “use Squid” as a proxy, you tell it to use whatever proxy is running on a certain host and port.

Many web browsers, including w3m, can take proxy settings from the environment. Set the variable http_proxy, e.g.

export http_proxy=http://localhost:3128/

Put this line in that account's ~/.profile, or put the line http_proxy=http://localhost:3128/ in ~/.pam_environment.

If you want to proxy HTTPS as well, put a similar line with https_proxy.

Alternatively, you can configure the proxy in w3m's configuration file, with a line in ~/.w3m/config

http_proxy http://localhost:3128/

This option can be set interactively in the options screen (press o then type /proxyEnter and type the proxy URL in the box for “URL of HTTP proxy host”).

You may want to set no_proxy as well to exclude some domains, e.g. set to localhost,127.0.0.1.

  • The option that you are suggesting to set interactively is for your user but it wouldn't work if as root I want to make a user to only use a specific proxy. – VaTo Aug 8 '17 at 23:26
  • @VaTo You'd have to run w3m as that user in order to modify that user's configuration file, e.g. su someuser -c w3m – Gilles Aug 8 '17 at 23:39
  • thank you, I also changed the title of the question so it just doesn't apply for squid proxies but for any proxy. – VaTo Aug 9 '17 at 0:04
0

I just found the answer if someone needs it:

I just had to set the proxy to the HTTP_PROXY variable:

e.g. export HTTP_PROXY="http://proxyURL:portnumber"

and in my case that I had to do it for a specific user, I only had to open the ~/.bashrc file for that user, and add the same line to it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.