• December 22, 2024

Terminal Socks Proxy

How to use socks proxy for commands in Terminal such as ...

How to use socks proxy for commands in Terminal such as …

I connect to a remote ssh server by running this command:
ssh -D 12345
This creates a socks proxy that I can use with Firefox to bypass censorship in my country. However, I can’t take advantage of it to in the command line.
Let’s say my country blocks access to youtube. How can I use the ssh connection to run a command such as:
youtube-dl “”
Without being blocked by the government? How I can set a socks proxy for all terminal commands?
kenorb16. 8k11 gold badges116 silver badges148 bronze badges
asked Apr 6 ’13 at 16:46
2
ssh -D 8080
export _proxy=socks5127. 0. 1:8080 _proxy=socks5127. 1:8080
answered May 7 ’14 at 23:05
amidevousamidevous6811 gold badge5 silver badges2 bronze badges
Youtube-dl doesn’t support a SOCKS proxy. There’s a feature request for it, with links to a couple of working proposals.
Youtube-dl supports HTTP proxies out of the box. To benefit from this support, you’ll need to run a proxy on Pretty much any lightweight proxy will do, for example tinyproxy. The proxy only needs to listen to local connections (Listen 127. 1 in). If the HTTP proxy is listening on port 8035 (Port 8035), run the following ssh command:
ssh -L 8035:localhost:8035
and set the environment variables _proxy and _proxy:
export _proxy=localhost:8035/ _proxy=localhost:8035/
youtube-dl
answered Apr 8 ’13 at 1:49
4
youtube-dl works well with proxychains on ubuntu. Make sure ur tunneling via command line.
ssh -D 8081 ubuntu@yourSSHserver
next install proxychains on your localhost not the ssh server ur conncted to.
sudo apt-get install proxychains
edit your proxychains config file
sudo nano /etc/
edit the port number on the last line
socks4 127. 1 8081
Note:I’m using proxychains on port 8081
then just add proxychains to the begining of the command when using youtube-dl
proxychains. /youtube-dl
answered Oct 4 ’15 at 16:23
1
You can use Delegate,
It’s a SOCKS server and/or client that can listen as HTTP proxy.
Download latest version of delegate and extract it.
First run your ssh command:
ssh -D 9150
Then, run binary delegate file with these options to have a HTTP proxy as a SOCKS client:
$. /dg9_9_13 -P8080 SERVER= SOCKS=127. 1:9150 ADMIN=””
Then, run youtube-dl with –proxy option to connect to listened HTTP proxy:
$ youtube-dl -v –proxy ”
answered Feb 20 ’15 at 22:02
Since youtube-dl version 2016. 05. 10, you can use –proxy to specify SOCKS proxy, e. g.
youtube-dl –proxy “socks5127. 1/” -v 9bZkp7q19f0
–proxy URL Use the specified HTTP/HTTPS/SOCKS proxy. To enable experimental SOCKS proxy, specify a proper scheme. For example socks5127. 1:1080/.
answered Apr 16 ’18 at 15:05
kenorbkenorb16. 8k11 gold badges116 silver badges148 bronze badges
If Youtube videos are what you are after, you might want to try cclive, which seems to support proxies. And it can do other streaming sites as well.
answered Apr 8 ’13 at 12:51
peterphpeterph28. 4k2 gold badges59 silver badges71 bronze badges
You can also use polipo to create an proxy and use your socks5 proxy as the parent proxy.
$ polipo socksParentProxy=127. 1:12345 # change accordingly
Established listening socket on port 8123
Now, you can use 127. 1:8123 as an proxy with any command-line tool that supports it.
answered Jun 14 ’20 at 12:12
refikrefik1011 bronze badge
Not the answer you’re looking for? Browse other questions tagged ssh proxy -proxy socks or ask your own question.
how to set socks5 proxy in the terminal - command line - Ask ...

how to set socks5 proxy in the terminal – command line – Ask …

I am a beginner using linux, I would like to connecting the terminal to the local proxy socks made by my ssh (Dynamic Port Forwarding),
so is there a way to set up a proxy socks5 in the terminal?
or should use an additional module,
or have to go through another tool,
thank you for your attention
asked Apr 17 ’15 at 6:52
I’m using Proxychains, an easy to use command line tool.
Usage:
sudo proxychains4 apt-get update
You can configure you proxy in the /etc/
[ProxyList]
socks5 127. 0. 1 12345
Zanna♦64k53 gold badges188 silver badges305 bronze badges
answered Apr 17 ’15 at 7:19
lumenlumen4251 gold badge4 silver badges15 bronze badges
You can use _proxy environmentvariable like this:
export _proxy=”socks5localhost:9050″
Now the terminal will use that as proxy.
Here I’m using tor proxy, but should work for you, too.
answered May 1 at 4:57
Not the answer you’re looking for? Browse other questions tagged command-line ssh syslinux or ask your own question.
Set proxy for terminal on mac - gists · GitHub

Set proxy for terminal on mac – gists · GitHub

Server-side setup
apt-get install python-pip
pip install shadowsocks
sudo ssserver -p 443 -k password -m aes-256-cfb –user nobody -d start
Client-side setup
Install Shadowsocks Client, e. g. run brew cask install shadowsocksx in Mac OSX.
SwitchSharp
Only config SOCKS Host to 127. 0. 1:1080 and select SOCKS v5
# `-N`: do not execute commands
# `-D`: bind 1080 port and forward 1080 port to 22 port
# `-i`: use pre-shared key “
# `-p`: specify port used to connect to remote server
ssh -ND 1080 -i ~/ @ -p 22
Reference
how-do-i-set-up-a-linux-proxy-for-my-mac by askubuntu
Using Proxychains-ng to socksify your command
Install proxychains-ng by running brew install proxychains-ng.
Config /usr/local/Cellar/proxychains-ng/4. 7/etc/, modify the following parameters.
[ProxyList]
socks5 127. 1 1080
Add proxychains4 to the front of every command, e. proxychains4 curl
Also works for Application like Google Chrome while Safari does not work, try proxychains4 /Applications/Google\ \ Chrome.
But this might slow down Chrome.
You can also use dsocks for mac(which does not work for me), tsocks for linux.
Using Unix Proxy Environment Variable
Add this script to ~/. bash_profile.
export _proxy=socks5127. 1:1080
Config curl to use SOCKS5(Also works for homebrew)
Add the following line to ~/ Since homebrew use curl to download the package, this will also enable homebrew to use SOCKS5.
socks5 = “socks5127. 1:1080”
There are no environment variables for SOCKS5 proxy servers in unix, so in order to use SOCKS5 in other utilities, check the man pages for existing tools to see if they have a configuration option for a SOCKS5 proxy and whether they have a configuration file that the configuration can be added to.
Config git to use SOCKS5
For and (e. g., ), run the following script.
git config –global ‘socks5127. 1:1080’
For git(e. git), run git config –global tproxy ‘socks5127. 1:1080’
For ssh(e. g., ssh), add ProxyCommand nc -x localhost:1080%h%p to ~/ file.
git config –global is stored in ~/. gitconfig while local config settings is in. /
To remove a configuration, e. run git config –global –unset tproxy.
how to set socks5 proxy in the terminal by askubuntu
OS X Terminal Ignoring SOCKS Proxy Setup
Git proxy through SOCKS 5 by cms-sw
git proxy on segmentfault
curl –socks5-hostname 127. 1:1080

Frequently Asked Questions about terminal socks proxy

Leave a Reply