Just in case you read my previous post, this one falls into the category of “things I figured out how to do” that I want to have a record of, in case I ever have to do it again. Note I am NOT saying this will work for anyone else (so don’t complain if you try it and can’t make it work, because about all I’ll be able to offer you is sympathy and dumb looks). Also note that this is probably not a procedure that rank beginners with Linux should attempt, since you could potentially mess up your system if something goes wrong.
These notes are for gSTM, the Gnome SSH Tunnel Manager version 1.2 running under Ubuntu. Normally, if you have it set to run at system startup its panel will be in the middle of the screen, and you have to click on the icon in the notification area (top bar tray, near the clock) to minimize it. This fixes that so you can start gSTM minimized (or start gSTM minimised, as our friends in
Canada and the U.K. would spell it). Of course, you probably don’t want to do this until you have finished setting up your tunnel(s).
- Using Synaptic or apt-get install the libgnomeui-dev package, if it’s not already installed.
- Go to http://sourceforge.net/projects/gstm/files/ and download the .tar.gz file for your distribution (probably gstm-1.2.tar.gz for most users).
- Uncompress the file you just downloaded in a temporary location and in a terminal window navigate to the src directory of the expanded file (cd gstm-1.2/src).
- Using a web browser go to the “Patches” section of the project at http://sourceforge.net/tracker/?group_id=145040&atid=760625 and click on “Close winodows & minimise patch” [sic] and once there click on the small arrow to the right of the words “Attached File ( 1 )” and a Download link should appear. Click on that to download a file named “patch” and save it to the aforementioned src directory.
- If any version of gSTM is currently running, quit it now.
- Run this command in the src directory: patch -i patch (note the second instance of “patch” refers to the file you just downloaded). If it complains about permissions, preface the command with sudo.
- If there are no errors applying the patch file, then run these three commands (if you’re not running as root then you’ll need to preface these with sudo): ./configure; make; make install
- Start gSTM using this command: gSTM –start-minimised-to-tray (U.S.A. users, note the U.K. spelling of “minimised”). This is also the command you should use in Ubuntu’s Startup Applications Preferences. Note that if you do click on the tray icon to open the window, pressing the close button or the quit button will now only hide the window. To actually quit the program you have to right click the tray icon and select quit.
- If everything works you can delete the source files to save a little space on your hard drive.
Hopefully this patch will be incorporated into a release version someday, but since the last actual release was in 2005, I’m not holding my breath. I’ll also note that there are two other patches available, an About Dialog Patch and a patch to show notification dialog icons, but since doing the above is really stretching my abilities in Linux (I’m strictly a GUI type of person, and hate working at the command line) and since I didn’t need either of the other patches, you’re on your own with those.
EDIT: If all you really want to do is start a SSH tunnel at system startup to create a SOCKS5 proxy (and run it in the background), you don’t necessarily need gSTM at all. In Ubuntu’s Startup Applications, you can add a “Startup Program” with a line similar to the following as the command string:
screen -dmS tunnel ssh username@serveraddress -D 7777
You can optionally replace tunnel with any other single word of your choice. Replace username@serveraddress with the user name and address of the server you wish to tunnel through. 7777 is the local port number for your SOCKS5 proxy and can be changed if desired. If you do this a tunnel should be set up at each reboot, provided that you have installed the screen utility on your system (it is not installed by default in Ubuntu, but can be easily installed using apt-get or synaptic). You’ll also need to change the permissions on a directory, but if you run the above line from a terminal window (leaving off the -dmS tunnel) the first time you run it, it should tell you what you need to do (if I recall correctly, you need to change the permissions of /run/screen to 775). The only problem with doing it this way is that if you lose the connection to the server you won’t be able to restart it without running the above command again.
EDIT2: For more ways to tunnel data using SSH, see Quick-Tip: SSH Tunneling Made Easy.