- Linux Proxy Server Settings – Set Proxy For Command Line
- Export Proxy Server Settings
- Test The Proxy Server From The Linux Command-Line
- Unset Linux Proxy Variables
- Automate Proxy Server Settings In Linux
- Lists of Free Public Proxy Servers
- How to configure proxy settings on Ubuntu 18.04
- Overview
- Ubuntu Desktop Network Settings
- Ubuntu Terminal Proxy Settings
- Single User Temporary Proxy Settings
- Single User Persistent Proxy Settings
- All Users
- Как настроить прокси в Linux
- Как настроить прокси в Linux
- В статье показано как настроить прокси в любой версии ОС Linux.
- Рассмотрим настройку переменных для использования прокси
- Тестирование работы
- Глобальные настройки прокси
- How To Use Proxy Server To Access Internet at Shell Prompt With http_proxy Variable
- Set http_proxy shell variable on Linux/OS X/Unix bash shell
- How do I setup proxy variable for all users?
- A note about enabling proxy access to a specific user
- How do I use password protected proxy server using various command line options?
Linux Proxy Server Settings – Set Proxy For Command Line
To use a proxy on the Linux command-line, you can set the environment variables http_proxy , https_proxy or ftp_proxy , depending on the traffic type.
These proxy server settings are used by the almost all Linux command-line utilities, e.g. ftp , wget , curl , ssh , apt-get , yum and others.
If you don’t know yet which proxy server to use, you can take one from the lists of the free public proxy servers at the end of this article.
Cool Tip: Need to improve security of the Linux system? Encrypt DNS traffic and get the protection from DNS spoofing! Read more →
Export Proxy Server Settings
Set these variables to configure Linux proxy server settings for the command-line tools:
If a proxy server requires authentication, set the proxy variables as follows:
Special Characters: If your password contains special characters, you must replace them with ASCII codes, for example the at sign @ must be replaced by the %40 code, e.g. p@ssword = p%40ssword .
Test The Proxy Server From The Linux Command-Line
First off all it is required to check that the proxy server settings are set in the corresponding proxy variables.
Than it is required to ensure that your public IP address has changed.
Also it would be interesting to measure and compare response time of the remote resources and the Internet speed with and without proxy.
Check the current proxy server settings:
Check your public IP address from the Linux command-line:
Compare the difference in the response time with the configured proxy and without it:
Check the Internet download speed through the proxy:
Unset Linux Proxy Variables
Use the following commands to disable proxy:
Cool Tip: Stay anonymous during port scanning! Use Nmap + Tor + ProxyChains ! Safe and easy penetration testing! Read more →
Automate Proxy Server Settings In Linux
If you use the same proxy server settings for the https , http and ftp traffic, you can use the following commands to set and unset the proxy settings:
If you use a proxy server often, you can create Bash functions as follows (add to your
Now use the setproxy and unsetproxy commands to set and unset Linux proxy server settings.
Lists of Free Public Proxy Servers
WARNING: Free public proxy servers can insert your IP address into the headers of requests or sniff your traffic! Don’t use them to transfer sensitive data and do not expect anonymity!
- Hide My Ass
- Proxy Server List
- Anonymous Public Proxy Servers
- Daily HTTP Proxies
Cool Tip: Even if you use proxy server, all your DNS queries still go to the name servers of your ISP (Internet Service Provider)! Improve anonymity, by using free public name servers! Read more →
Источник
How to configure proxy settings on Ubuntu 18.04
Overview
Proxies are commonly found on business networks, but they are increasingly becoming popular for personal use. The following tutorial will show you multiple ways of setting your proxy in Ubuntu 18.04, allowing you to browse the Internet with additional privacy.
This tutorial will cover the following three areas. Use the one the fits your needs.
Desktop: learn how to set your proxy settings from within the desktop.
Terminal: set environment variables for your proxy server when using a terminal or console.
All users: setting the proxy settings for all users on the system.
Ubuntu Desktop Network Settings
To configure your proxy settings in Ubuntu Desktop you need to access Network Settings. Within there you can set a number of parameters, including proxy settings for HTTP traffic, HTTPS traffic, and FTP traffic.
Equally as important as setting your Internet proxy settings is setting Ignore Hosts, to prevent local traffic from going through your proxy server.
To set your proxy in Ubuntu Desktop, do the following:
- Open the Application launcher by clicking the “Show Applications” icon, located at the bottom of the left-hand quick application access bar.
- Type in ‘Settings’
- Click the ‘Settings’ icon.
- From the left-hand navigation, click the Network tab.
Network Settings Configuration Screen
Click the cog icon near the Network Proxy label.
Network settings proxy icon
Ubuntu Proxy Settings Dialog Box
Ubuntu Terminal Proxy Settings
Like every Linux distribution, proxy settings can be set using environment variables. There are a number of variables available to use, ranging from HTTP traffic to FTP traffic.
Proxy settings can be either persistent by setting them in your profile, or non-persistent by setting them from the shell session.
Variable | Description |
---|---|
http_proxy | Proxy server for HTTP Traffic. |
https_proxy | Proxy server for HTTPS traffic |
ftp_proxy | Proxy server for FTP traffic |
no_proxy | Patterns for IP addresses or domain names that shouldn’t use the proxy |
The value for every proxy setting, except for no_proxy, uses the same template. They all require a hostname, but you may optionally specify a proxy server port and your user credentials if required to do so. For example:
Single User Temporary Proxy Settings
You may not always want to force Internet traffic through a proxy. Sometimes you need to override existing settings, and you can do this safely by setting the proxy environment variables from the command line.
The following will set a proxy for HTTP and HTTPS, while preventing local traffic from going through the proxy. Our example proxy server endpoint is my.proxy.server:8080 for HTTP traffic and my.proxy.server:8081 for HTTPS.
- Open a Terminal window where you need proxy access.
- Set and export the HTTP_PROXY variable.
- Set and export the HTTPS_PROXY variable.
- Set and export the NO_PROXY variable to prevent local traffic from being sent to the proxy.
Single User Persistent Proxy Settings
- Open your bash profile file into a text editor.
- Add the following lines, modifying them to match your environment.
- Save your settings.
- The proxy settings will be applied the next time you start a session, by logging into the server or opening a new Terminal window from a Desktop.
- To force apply your new proxy settings in the current Terminal session, execute the source command against your bash profile.
All Users
You will need administrative rights to perform this task. All versions of Ubuntu and Debian have a file called /etc/environment. Within this file, we can set global variables and other such things.
Similar to how you set proxy settings for your own local proxy, we’ll be adding the environment variables to this file. The variables will be set when a new user session is created, which is to say when you log in next.
- Using an administrator account, open /etc/environment into a text editor.
- Add the following lines, modifying them to fit your environment. Username and password may be omitted, if not required.
For example, if you do not need to enter a username or password, and your proxy server is my.proxyserver.net at port 8080, and you do not want local traffic going through the proxy, you would enter the following:
Источник
Как настроить прокси в Linux
Как настроить прокси в Linux
В статье показано как настроить прокси в любой версии ОС Linux.
Прокси-сервер или proxy — в переводе с англ. «представитель» — сервер как комплекс программ в компьютерных сетях, позволяющий клиентам выполнять косвенные запросы к другим сетевым службам. В рамках данного материала прокси понимается сервер выполняющий доступ к глобальной сети интернет.
Проще всего для использования прокси в командной строке, но в зависимости от типа трафика, Вы можете определить переменные окружения http_proxy, https_proxy или ftp_proxy.
Практически все утилиты командой строки, такие как curl, wget, ssh, apt-get, ftp, wget, yum и прочие, используют данные переменные.
Рассмотрим настройку переменных для использования прокси
Используйте следующий синтаксис для настройки таких типов трафика как http, https и ftp из командной строки:
$ export ftp_proxy=»http://proxy-server:port»
$ export http_proxy=»http://proxy-server:port»
$ export https_proxy=»https://proxy-server:port»
Используйте следующий синтаксис, если прокси-сервер требует аутентификацию:
$ export http_proxy=»http://user:pass@proxy-server:port»
$ export https_proxy=»https://user:pass@proxy-server:port»
$ export ftp_proxy=»http://user:pass@proxy-server:port»
Если Ваш пароль содержит спец. символы, Вы должны заменить их на ASCII коды.
Например символ собаки «@», должен быть заменен на «%40» (т. е. p@ss = p%40ss).
Тестирование работы
Используйте следующую команду для проверки текущих переменных прокси:
$ env | grep -i proxy
Можно проверить работу прокси, узнав ваш внешний IP адрес из командной строки:
Источник
Глобальные настройки прокси
Доброго вечера. Нагуглил такой метод для Хрома, так как он требует глобальную проксю:
В Лисе еще печальнее. Если указать http proxy в сетевых настройках, то не открывается ни одна страница, мол тор не http proxy, но socks и используйте его. Если же не указывать http, то не открываются сайты по https, например https://linux.org.ru скрин.
Отсюда вопрос номер один: как правильно настроить прокси для всей системы?
Номер два: как заставить Огнелиса открывать https через тор?
Номер два: как заставить Огнелиса открывать https через тор?
Тор первый раз вижу, но УМВР (пруфскрин).
Если вы хотите использовать SOCKS-proxy system-wide, то надо не полагаться на лояльность Хрома, Файрфокса и прочего софта вашим настройкам, а принудительно и прозрачно для прикладного ПО заворачивать весь TCP-трафик.
redsocks (или аналог) в помощь.
/.profile или вовсе /etc/environment.
/.bashrc не выполняется при запуске X-сессии.
Если указать http proxy в сетевых настройках, то не открывается ни одна страница, мол тор не http proxy, но socks и используйте его.
Видимо он полагает, что у вас запущен Гном или Кеды.
Добавил в .profile, перелогинился, Хрому не помогло. Второй вопрос решен методом научного тыка, Лисе надо было только socks proxy указывать. С redsocks не разобрался.
См. выше. Вы точно уверены, что не пользуетесь Гномом / Кедами?
Хм, а вот вы верно заметили,
таки заработал через тор. С натяжкой можно назвать вопрос решенным, пойду искать мануал по redsocks’у всё же. Всем спасибо 🙂
Точно. Я пользуюсь Openbox и, иногда, Awesome.
Источник
How To Use Proxy Server To Access Internet at Shell Prompt With http_proxy Variable
I ‘m behind a squid proxy server. How do I access internet via proxy server when I use wget, lynx and other utilities from a shell prompt on a Linux or Unix-like systems?
Linux and UNIX-like systems has environment variable called http_proxy. It allows you to connect text based session and/or applications via the proxy server. All you need is proxy server IP address (URL) and port values. This variable is almost used by all utilities such as elinks, lynx, wget, curl and others commands.
Tutorial details | |
---|---|
Difficulty level | Easy |
Root privileges | No |
Requirements | Linux/Unix shell promot |
Est. reading time | 2 mintues |
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=http://127.0.0.1:3128/
$ export http_proxy=http://proxy-server.mycorp.com:3128/
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@127.0.0.1:3128/
$ export http_proxy=http://USERNAME:PASSWORD@proxy-server.mycorp.com:3128/
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=http://proxy-server.mycorp.com:3128/
OR
export http_proxy=http://USERNAME:PASSOWRD@proxy-server.mycorp.com:3128/
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
OR
# vi /home/vivek/.bash_profile
Append the following line:
export http_proxy=http://USERNAME:PASSOWRD@proxy-server.mycorp.com:3128/
Save and close the file.
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
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 http://path.to.domain.com/some.html
Lynx command has the following syntax:
$ lynx -pauth=USER:PASSWORD http://domain.com/path/html.file
Curl command has following syntax:
$ curl —proxy-user user:password http://url.com/
🐧 Get the latest tutorials on Linux, Open Source & DevOps via
Источник