There are some http file links I can not access, but I have a remote server which can access them.
To download these files to my machine, I use the remote server as a "proxy". This is what I did:
ssh
to remote server- execute
wget
command on remote server to download the file - transfer the downloaded file to my machine through
scp
command
I want to ask if there exist more convenient method to achieve it? like:
some_command root@server http://xxxxx/file.zip ~/Desktop/
Thanks:)
Best Answer
ssh provides a convenient TCP SOCKS5 proxy mode with its -D/DynamicForward option (let's use the default SOCKS port: 1080, you can use any port as long as its referenced in the later settings):
You can instead run the ssh command in background so it stays available without needing to keep it in a terminal for later:
Unfortunately
wget
itself doesn't support the SOCKS protocol.curl
is fine with it with either:or just:
If you really need
wget
you must use a wrapper. For example there'sproxychains
which relies onLD_PRELOAD
interception (there are others, like dante'ssocksify
client wrapper working in a similar way orredsocks
which itself relies on a special firewall setup for interception).