Penguin

Differences between version 78 and predecessor to the previous major change of SSHNotes.

Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History

Newer page: version 78 Last edited on Tuesday, May 13, 2008 5:09:43 pm by ShaneHowearth Revert
Older page: version 77 Last edited on Sunday, June 25, 2006 8:45:10 am by AristotlePagaltzis Revert
@@ -94,8 +94,9 @@
  
 If you don't need the shell, and just want the tunnel, you can add options <tt>-f</tt> (go to background before command execution) and <tt>-N</tt> (don't execute remote command): <tt>ssh -f -N -L 5000:localhost:80 user@host.remote</tt> [SSH] will then effectively run as a daemon. 
  
 If you add <tt>-g</tt>, your local end of the [SSH] tunnel will accept connections from anyone, not just <tt>localhost</tt>. Say there are two machines called <tt>host1.lan</tt> and <tt>host2.lan</tt> on a [LAN]. By doing 
+  
  
 <verbatim> 
 host1$ ssh -f -g -N -L 5000:localhost:80 user@host.remote 
 host2$ lynx host1:5000 
@@ -106,8 +107,27 @@
 Imagine the fun you can have with multiple [SSH] forwards! 
  
 If you've set up your <tt>.ssh/config</tt> as in the tip above, you can spare yourself typing the same parameters to set up tunnels in the same manner. <tt>-L 5000:localhost:110</tt> translates to <tt>~LocalForward 5000 localhost:110</tt>. If you'd like to have <tt>-g</tt> taken care of as well, add <tt>~GatewayPorts</tt>. <tt>-f</tt> and <tt>-N</tt> don't have corresponding options, but those wouldn't be very useful anyway. 
  
+  
+!! vhost workaround  
+  
+When trying to connect to an apache server (through a firewall) that has multiple vhosts, you may be able to get the default page apache has been configured to serve, but nothing else.  
+On your localhost edit your /etc/hosts file and add the name of the machine you are trying to connect to over the tunnel.  
+  
+eg. If you were trying to connect to cms-r7-113.cs.waikato.ac.nz  
+add the following to /etc/hosts  
+  
+127.0.0.1 cms-r7-113.cs.waikato.ac.nz  
+  
+and construct your tunnel thus  
+  
+ssh -2 -q -f -N -g -L 80:cms-r7-113.cs.waikato.ac.nz:80 <username>@cms-r7-113.cs.waikato.ac.nz  
+  
+You will now be able to connect to  
+<verbatim>  
+cms-r7-113.cs.waikato.ac.nz/~username  
+</verbatim>  
  
 !!! [X] Connection Forwarding 
  
 If you use the <tt>-X</tt> option to ssh(1), you will enable [X]-connection forwarding. This is essentially a reverse port forward with a few added effects: for instance it will set your <tt>DISPLAY</tt> EnvironmentVariable on the remote end to something like <tt>localhost:15</tt>. Most of the time you won't need to mess with xhost(1) or xauth(1) either. If you've set up your <tt>.ssh/config</tt> as discussed above, you can spare yourself typing <tt>-X</tt> every time using the <tt>ForwardX11</tt> directive.