SSH Socks Proxy

fionab

Well-Known Member
Joined
Dec 28, 2007
Messages
329
Reaction score
5
Location
Gauteng
Morning all
I was thinking of setting up a SSH server off my international web hosting.
I was wondering if anyone had any comments regarding the benefits and if it is a good thing to do. I want to be able to queue downloads to this server then download when needed.
 
Well I never used ssh for an overseas server ( Used it to connecto to home from work ) but yeah one of the benefits is that it is secure :p and allowed me to access the internet on my home pc from work :)

I see 'proxy' in the topic title, are you attempting this to bypass a proxy server?

If so that's also another great benefit :)
 
A VPN server (OpenVPN / PPTP VPN) would probably be better than a SSH proxy. SSH can only proxy TCP, where as VPN's can "proxy" UDP packets too.

Just ensure that your webhost allows proxy/VPN services to be hosted on their servers. Some web hosting services would explicitly forbid those kind of stuff in their Terms of Services.
 
My host only allows SSH,has anyone used this option to store downloads with then download afterhours or weekends?
 
What I did was setup a linux box (maybe your server is also linux I assume) then install squid proxy and sshd.

Then I used putty at work to ssh into the server and set my firefox to use the proxy and voila.

I suppose you could also store downloads by setting up a ftp on the server as well :confused:

Maybe you can use a script and wget to do the download and then ftp into the server to copy them off, or even use scp.
 
I know: setup cron to run a script every few minutes that checks a specific file for a list of files that needs to be downloaded using wget. That way you can just add new files to the list when needed.

Then use scp to copy the file off the server.

That should work.

Let me know if you want more specific...
 
Last edited:
Stevovo
That sounds just what I need...more details would be handy, you can pm me.
Yes my server is a linux box
 
Okay this is what I could come up with :)

First go to your home directory and create the following script:

Code:
#!/bin/bash

FILE=file_list_with_downloads

ps -e | grep wget
if [ $? = 0 ]; then exit; fi #exit if wget is already downloading

cd ~/ #we want to download file to home folder
wget `head -1 $FILE`& #start wget and download the first file in the list
sed -i '1 d' $FILE #after that delete the first line so it's not downloaded again

For example we can call this script "download".

Next we need to add a cron job so that this script is executed automatically.

Code:
sudo echo "5 * * * * /home/USER/download" >> /etc/crontab

Change USER with your username. The 5 means it will check every 5 minutes if it can download the next file.

Make sure the download script is executable:

Code:
chmod +x ~/download

Next you need to create the download list file (the one that says file_list_with_downloads in the above script). You can use a different name if you like, just be sure to update it in the script.

Then you can add your downloads to the file like so:

Code:
echo "http://someserver.com/somefile.zip" >> file_list_with_downloads

And once the files are downloaded you can use pscp.exe from PuTTY. (I am assuming you have a windows machine at home)

Then open a dos screen, chdir to the folder where you downloaded pscp.exe and execute with the following command:

Code:
pscp [email protected]:/home/USER/FILE c:\downloads

Where USER is the username on the remote linux host and FILE is the name of the file that was downloaded (not including the full path ie. only the filename (somefile.zip) and c:\downloads you probably know what that is :)

Be WARNED though that I have not tested this and something might be wrong :D
 
Last edited:
Very clever little script. Thanks Stevo.
I wonder if my hosting company will let me run something like that on my server.
 
I would assume that they would allow it as long as its intended for personal use and that you're not going to download illegal content :) After all, you pay for the bandwidth that your server may use...
 
...has anyone used this option to store downloads with then download afterhours or weekends?

Have you thought this through properly?

My opinion on this is that all you are going to succeed in doing is downloading the same file twice. You'll be limited to http:// or ftp:// transfers to the server, you wont be allowed to torrent from the box.

Then when your files have downloaded to the overseas box and it's convenient for you... you are going to download them again? Why don't you just download the file when it's good for you from home to begin with.
The only slight benefit of an SSH tunnel is the compression you can achieve on uncompressed data. e.g browsing websites (text/html), transferring large binary's will see no benefits whatsoever.
 
Top
Sign up to the MyBroadband newsletter
X