{"id":17,"date":"2013-09-25T16:17:30","date_gmt":"2013-09-25T16:17:30","guid":{"rendered":"http:\/\/linux.mycustomcycle.com\/?p=17"},"modified":"2015-02-19T19:35:29","modified_gmt":"2015-02-19T19:35:29","slug":"ssh","status":"publish","type":"post","link":"http:\/\/linux.suriyasuneel.com\/?p=17","title":{"rendered":"SSH"},"content":{"rendered":"<h3>tunnel ports settings in Windows 7<\/h3>\n<p>if you try to setup tunneling in the ssh clients mostly the client will crash. the easy way is to find the config file for ssh client in the folder<\/p>\n<pre>C:\\Users\\kamarj\\AppData\\Roaming\\SSH<\/pre>\n<p>each profile will be stored as default.ssh2 or jc.ssh2 (the two profiles that i have now).<br \/>\nOpen the file in a text editor and type the following for tunneling vnc through ssh2<\/p>\n<pre>[Outgoing Tunnels]\r\nTunnel=S:vnc,5901,localhost,5901,1,tcp\r\nTunnel=S:vnc2,5902,localhost,5902,1,tcp<\/pre>\n<p>save the file and restart the client. you will see the tunneling options appear in the corresponding tab.<\/p>\n<h3>tunnel ports<\/h3>\n<p>ssh -N -l someuser -L 143:localhost:143 -L 25:localhost:25 jaya.homelinux.org<\/p>\n<h3>Forward X11<\/h3>\n<p>if you want to forward X through ssh we call as follows<br \/>\nssh -X jc@servername<br \/>\nif you find that you cannot open any X clients and we get the following error message<br \/>\nxterm Xt error: Can&#8217;t open display:<br \/>\nxterm: DISPLAY is not set<br \/>\nthen you can find out what is happening by using the following<br \/>\nssh -X -v jc@servername<br \/>\nwhich will give verbose information such as<br \/>\ndebug1: Requesting X11 forwarding with authentication spoofing.<br \/>\ndebug1: Remote: No xauth program; cannot forward with spoofing.<br \/>\nthen xauth was not installed.<br \/>\nthis xauth is part of the package xbase-clients.<\/p>\n<h3>SSH login Banner<\/h3>\n<p>I always that it is cool to get the banner that gives some security warning before you login to the server. My school systems had it and never bothered to install it in mine.<br \/>\nOpen \/etc\/ssh\/sshd_config<br \/>\nuncomment or add this line<\/p>\n<pre>Banner \/etc\/issue.net<\/pre>\n<p>Edit the file issue.net with the contents that you want to display. now you got a dialog box with the message. The other type of message is motd or &#8220;Message of the day&#8221;. just edit the file \/etc\/motd and that will be printed everytime you login.<br \/>\n&#8212;&#8212;&#8212;&#8211;18-August-2006.<\/p>\n<h3>SSH Server Configuration<\/h3>\n<p>I had some problem with the debian SSH server for some time. It is not that i can&#8217;t use it at all. The problem is with the authentication. It is something like challenge\/response authentication which i never liked. I wanted to change it to normal Password authentication and no luck. Finally I got it from someplace\u00a0<a href=\"http:\/\/open.bsdcow.net\/tutorials\/ssh_pubkey_auth#1.4\">here<\/a>. All i had to was to configure the server to accept Password Authentication instead of the default Public Key Authentication.<br \/>\nOpen the \/etc\/ssh\/sshd_config file<br \/>\nLocate the line below in config file<\/p>\n<pre>   PasswordAuthentication yes\r\n   ChallengeResponseAuthentication no\r\n   PubKeyAuthentication no<\/pre>\n<p>and disable the above option by place a # in front of it.<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;06\/28\/04<\/p>\n<h3>X11 over SSH for Root<\/h3>\n<p>May be I&#8217;m not lucky anymore. usually whenever i have trouble, i google it and within two or three tries, i get the answer, because i had the correct keywords. This is the problem I had<br \/>\nI ssh to my debian machine from my work laptop(windows 2000, cygwin X Server), forward X11 and run X application. Suddenly one fine day I cannot run application esp &#8220;make xconfig&#8221; as a super user.<br \/>\nI got different error messages<\/p>\n<pre>X11 server shutdown \r\nX11 server reset<\/pre>\n<p>my google result didn&#8217;t get me any answer, because my keywords were not good enough. But i got the perfect keyword, which was<\/p>\n<pre>X11 connection rejected because of wrong authentication<\/pre>\n<p>with this keyword i got the most appropriate result for my quest.\u00a0<a href=\"http:\/\/groups.google.com\/group\/comp.security.ssh\/browse_frm\/thread\/7cf5eff6aa91d1a6\/2819d20f2b3d2e79?lnk=st&amp;q=x11+connection+rejected+wrong+authentication+su&amp;rnum=2&amp;hl=en#2819d20f2b3d2e79\">from google group or usenet<\/a>.<br \/>\nThe answer is simple<br \/>\nThe default location of the Xauthority file is changed. And when you ssh, normally export XAUTHORITY=\/tmp\/whatever was done, now it doesn&#8217;t work that way anymore. So now once you su(again you don&#8217;t want to ssh to your machine as root, that will open a huge can of worms), all you have to do is let the system know about the .Xauthority file as follow<\/p>\n<pre>export XAUTHORITY=\/home\/jc\/.Xauthority<\/pre>\n<p>or copy this into the roots home directory.<br \/>\nNow when i play with xserver sometimes some of the packages get lost, and then when i try to forward X through ssh, i get the following warning<\/p>\n<pre>(application:number):Gtk-WARNING ** : error cannot open display:<\/pre>\n<h3>SSH disconnect<\/h3>\n<p>This might help. open sshd config<br \/>\nClientAliveInterval 45 ClientAliveCountMax 50<\/p>\n","protected":false},"excerpt":{"rendered":"<p>tunnel ports settings in Windows 7 if you try to setup tunneling in the ssh clients mostly the client will crash. the easy way is to find the config file for ssh client in the folder C:\\Users\\kamarj\\AppData\\Roaming\\SSH each profile will be stored as default.ssh2 or jc.ssh2 (the two profiles that i have now). Open the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"_links":{"self":[{"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=\/wp\/v2\/posts\/17"}],"collection":[{"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=17"}],"version-history":[{"count":1,"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=\/wp\/v2\/posts\/17\/revisions"}],"predecessor-version":[{"id":18,"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=\/wp\/v2\/posts\/17\/revisions\/18"}],"wp:attachment":[{"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=17"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=17"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=17"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}