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.
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 /proxy
Enter 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
.
su someuser -c w3m
Commented
Aug 8, 2017 at 23:39
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.
.bashrc
, that's for shell settings. Set environment variables in .profile
.
Commented
Aug 8, 2017 at 23:03