viernes, febrero 15, 2019

activar Proxy en la shell de Linux

Set http_proxy shell variable on Linux/OS X/Unix bash shell

Type the following command to set proxy server:
$ export http_proxy=http://server-ip:port/
$ export http_proxy=
$ export http_proxy=

If the proxy server requires a username and password then add these to the URL. For example, to include the username foo and the password bar:
$ export http_proxy=http://foo:bar@server-ip:port/
$ export http_proxy=http://foo:bar@
$ export http_proxy=

How do I setup proxy variable for all users?

To setup the proxy environment variable as a global variable, open /etc/profile file:
# vi /etc/profile
Add the following information:
export http_proxy=
export http_proxy=
Save and close the file.

A note about enabling proxy access to a specific user

To enable proxy access for a specific user, add the lines user shell profile. For the default bash shell, the profile is the file .bash_profile. For example, enable proxy access for a specifc user called vivek, type:
$ vi $HOME/.bash_profile
# vi /home/vivek/.bash_profile
Append the following line:
export http_proxy=
Save and close the file.

How do I use password protected proxy server using various command line options?

You can simply use wget command as follows:
$ wget --proxy-user=USERNAME --proxy-password=PASSWORD
Lynx command has the following syntax:
$ lynx -pauth=USER:PASSWORD
Curl command has following syntax:
$ curl --proxy-user user:password

No hay comentarios: