{"id":37,"date":"2004-07-24T14:19:33","date_gmt":"2004-07-24T19:19:33","guid":{"rendered":"\/?p=37"},"modified":"2004-07-24T14:19:33","modified_gmt":"2004-07-24T19:19:33","slug":"ssh-tunnelling","status":"publish","type":"post","link":"https:\/\/thestidhams.com\/tom\/wp\/2004\/07\/24\/ssh-tunnelling\/","title":{"rendered":"ssh tunnelling"},"content":{"rendered":"<p>I always thought that doing X11 tunnelling with ssh would be a hard thing to setup and understand but it turns out to be quite easy.<\/p>\n<p>\nFirst of all on the machine being connected to (remotehost) change the sshd_config file to include:<br \/>\nX11Forwarding yes<br \/>\nthen kill -HUP the sshd client.<\/p>\n<p>\nNext when connecting from linux use the following syntax:<br \/>\nssh -X remotehost<br \/>\nlogin as usual.<\/p>\n<p>Now try a simple xterm &#038; to see if it works. It went first time for me.<\/p>\n<p>The extended entry contains the html from the page I found this.  If it is still working you can reach it <a href=\"http:\/\/www.cag.lcs.mit.edu\/~wentzlaf\/faq\/ssh_X.html\">here<\/a>.  I copied the source over since this is being hosted on a .edu site and it will likely disappear once the student leaves school.<\/p>\n<p><p>\n<!--more--><br \/>\n<H3><br \/>\nHow to tunnel X over ssh<br \/>\n<\/H3><br \/>\n<P align=\"left\"><br \/>\nSo I am sure this exists somewhere else on the web, but here is my two cents for what you need to do to get automatic X tunneling.<br \/>\n<\/P><br \/>\n<P><br \/>\nFor instructive purposes, we will use a small scenario to explain what needs to be done.  There are two machines names <I>my_local_machine<\/I> and <I>far_away_machine<\/I>.  <I>my_local_machine<\/I> is the machine whose local X server that you want to display to and <I>far_away_machine<\/I> is the machine that you want to run a program on and have it displayed to <I>my_local_machine<\/I>.<br \/>\n<\/P><br \/>\n<P align=\"left\"><br \/>\nSteps that you need to do:<br \/>\n<OL><br \/>\n<LI>Make sure that the machine that you are connecting to, <I>far_away_machine<\/I>, has the following line in its sshd_config file.  This file usually lives in either &#8216;\/etc\/&#8217; or &#8216;\/etc\/ssh&#8217;.<BR><br \/>\nX11Forwarding yes  (THIS IS THE LINE THAT YOU NEED)<BR><br \/>\nIf this is not there contact the owner\/sysadmin for the <I>far_away_machine<\/I> and have this line added.<br \/>\n<LI><br \/>\n<UL><br \/>\n<LI>If you are using Windows on <I>my_local_machine<\/I>:<BR><br \/>\nGet a ssh agent which supports ssh tunneling.  I use a nice free open source one which is an extension to Tera Term.  It is called <A href=\"http:\/\/www.zip.com.au\/~roca\/ttssh.html\">TTSSH<\/A>.  So go and get Tera Term and the TTSSH extension and install them.  Now turn on the X tunneling.  This is done by going into the Setup->SSH Forwarding menu and make sure that the Display remote X applications in local X server is checked.  Now save Setup->Save Setup your configuration, use the default name, so that the next time that you run TTSSH you don&#8217;t have to recheck that box.  There is an equivalent check box for most other windows programs like FSecure, etc.<br \/>\n<LI>If you are using UNIX\/Linux on <I>my_local_machine<\/I>:<BR><br \/>\nSo for this to work you need to either pass a flag to ssh, notably the -X flag, or set up your systems global ssh_config file to contain:<BR><br \/>\nForwardX11 yes<BR><br \/>\nssh_config lives in either &#8216;\/etc\/&#8217; or &#8216;\/etc\/ssh&#8217; on most machines.  Also this may not even be needed based on how your ssh client was compiled.<br \/>\n<\/UL><br \/>\n<LI>Log into <I>far_away_machine<\/I> and type &#8216;xterm &#038;&#8217; or something like that and see the ssh tunneled window appear on <I>my_local_machine<\/I>&#8216;s screen.<br \/>\n<\/OL><br \/>\n<\/P><\/p>\n<p><P><br \/>\n<H3>Frequently Asked Questions<\/H3><br \/>\n<UL><br \/>\n<LI> Q: Does this work through a firewall? <BR><br \/>\nA: Yes, it should, or at least if ssh works through your firewall, tunneling X through it should work because ssh does a point-to-point encryption of all of your traffic thus when using X Windows over ssh, all of your data uses the same TCP connection that is used for the data that you type.  Thus a firewall cannot determine the difference of X traffic and you just typing a lot.<\/p>\n<p><LI> Q: If I am running Windows, do I need a local X server to remotely display X traffic to? <BR><br \/>\nA: Yes, Windows does not currently ship with a local X Windows Server.  I personally use <A href=\"http:\/\/www.hummingbird.com\/products\/nc\/exceed\/index.html\">Exceed<\/A> because it is fast, but it is also relatively expensive.  If you are looking for a cheaper solution, I know that <A href=\"http:\/\/www.microimages.com\/freestuf\/mix\/\">Mircoimages<\/A> sells a cheaper one for windows called MI\/X for $25 with a free trial.  Also, <A href=\"http:\/\/cygwin.com\/xfree\/\">Cygwin<\/A> has a free port of XFree86 for windows but cygwin might be difficult to install (I haven&#8217;t installed Cygwin for years, but I have heard it is much easier to install now).<\/p>\n<p><LI> Q: Do I need xauth installed on the <I>far_away_machine<\/I>?<BR><br \/>\nA: Yes, I learned this the hard way when trying to follow my own directions and failing on a very minimal system.  Once xauth is installed everything works.<\/p>\n<p><\/UL><br \/>\n<\/P><br \/>\n<P><br \/>\nIf you like this page send me some e-mail at wentzlaf AT cag.lcs.mit.edu<BR><br \/>\nYou can also find more contact info for me on my <A href=\"..\/index.html\">homepage<\/A><br \/>\n<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I always thought that doing X11 tunnelling with ssh would be a hard thing to setup and understand but it turns out to be quite easy. First of all on the machine being connected to (remotehost) change the sshd_config file to include: X11Forwarding yes then kill -HUP the sshd client. Next when connecting from linux [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/thestidhams.com\/tom\/wp\/wp-json\/wp\/v2\/posts\/37"}],"collection":[{"href":"https:\/\/thestidhams.com\/tom\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thestidhams.com\/tom\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thestidhams.com\/tom\/wp\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thestidhams.com\/tom\/wp\/wp-json\/wp\/v2\/comments?post=37"}],"version-history":[{"count":0,"href":"https:\/\/thestidhams.com\/tom\/wp\/wp-json\/wp\/v2\/posts\/37\/revisions"}],"wp:attachment":[{"href":"https:\/\/thestidhams.com\/tom\/wp\/wp-json\/wp\/v2\/media?parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thestidhams.com\/tom\/wp\/wp-json\/wp\/v2\/categories?post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thestidhams.com\/tom\/wp\/wp-json\/wp\/v2\/tags?post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}