{"id":3377,"date":"2010-07-21T23:06:52","date_gmt":"2010-07-22T03:06:52","guid":{"rendered":"http:\/\/g33kinfo.com\/info\/?p=3377"},"modified":"2010-07-21T23:06:52","modified_gmt":"2010-07-22T03:06:52","slug":"ssh-infoz","status":"publish","type":"post","link":"https:\/\/g33kinfo.com\/info\/ssh-infoz\/","title":{"rendered":"SSH infoz"},"content":{"rendered":"<p>From <a href=\"http:\/\/derwiki.tumblr.com\/post\/841579929\/how-i-learned-to-stop-worrying-and-love-ssh\">derwiki.tumblr.com<\/a><\/p>\n<p><strong><a href=\"http:\/\/derwiki.tumblr.com\/post\/841579929\/how-i-learned-to-stop-worrying-and-love-ssh\">How I Learned to Stop Worrying and Love SSH<\/a><\/strong><\/p>\n<p>Before there were VPNs, there was ssh. And when you don\u2019t have access to your VPN or can\u2019t set one up, you can still get most of the functionality over ssh.<\/p>\n<p><strong>Quick and dirty HTTP tunneling<\/strong><\/p>\n<p>This is useful if you need to hit an internal server through a proxy server:<br \/>\n<code><br \/>\nssh -f -N -L 31609:hostireallywanttogetto.com:80 proxyhost.com<br \/>\n<\/code><br \/>\nand then load http:\/\/localhost:31609 in your browser and it will look like\u00a0http:\/\/hostireallywanttogetto.com from proxyhost.com\u2019s point of view. Similarly:<br \/>\n<code><br \/>\nssh -f -N -L 31610:securehost.com:443 proxyhost.com<br \/>\n<\/code><br \/>\nwill forward SSL traffic to https:\/\/localhost:31610\/. Not gonna work completely, but it\u2019s a quick and dirty solution I\u2019ve used to get to internal wiki servers before.<\/p>\n<p><strong>Quicker and Dirtier SSH tunneling<\/strong><\/p>\n<p>This isn\u2019t very different from ssh\u2019ing into one box and immediately ssh\u2019ing to another. It avoids an extra bash process and it\u2019s quicker, but that\u2019s really it \u2014 except for the BAMF factor:<br \/>\n<code><br \/>\nssh -t gatewaymachine.com ssh hostireallywanttogetto<br \/>\n<\/code><\/p>\n<p><strong>Reverse SSH tunneling a shell<\/strong><\/p>\n<p>Got a computer behind a firewall whose configuration you don\u2019t have access to? It\u2019s pretty easy to get the computer behind the firewall to poke out to another server.<\/p>\n<p>(step 1, from the computer you wish to access)<br \/>\n<code>derwiki@firewalledcomputer:~$ ssh -R localhost:2002:localhost:22 mypublicserver.com<\/code><\/p>\n<p>(step 2, from any computer than can access mypublicserver.com)<br \/>\n<code>derwiki@mylaptopontheinternet:~$ ssh mypublicserver.com -p 2002<br \/>\n(authenticate)<br \/>\nderwiki@firewalledcomputer:~$<\/code><\/p>\n<p>I\u2019ve found this especially useful to get into my dad\u2019s computer and fix things. I put the \u201cssh -R\u201d command into a shell script called \u201cletadamin\u201d, made it executable, and put it on his desktop. Now it\u2019s super easy for him to grant me access in.<\/p>\n<p><strong>Tunneling SCP through a gateway<\/strong><\/p>\n<p>Sometimes you want to file transfer through a gateway machine:<br \/>\n<code><br \/>\nssh -N -L 1234:targetmachine:22 mypublicserver.com<br \/>\nscp -P 1234 localhost:~\/remotefile localfile<br \/>\n<\/code><br \/>\n<strong>Quickly setting up passwordless SSH<\/strong><\/p>\n<p>First make sure you\u2019ve generated a key file: ssh-keygen<br \/>\nUbuntu (and other Linux distros) make it really easy:<br \/>\n<code>ssh-copy-id user@remotehost<\/code><br \/>\nOS X seems to lack this, so the quick one liner I have is:<br \/>\n<code>cat ~\/.ssh\/id_dsa.pub | ssh username@myslicehostserver.com \u201ccat -\u00a0\u00bb ~\/.ssh\/authorized_keys\u201d<\/code><br \/>\nThese are the most frequent ssh commands that I\u2019ve \u201cdiscovered.\u201d What\u2019s your favorite thing to do with ssh that I\u2019ve missed?<\/p>\n<p><em>Thanks to Lann and Shivaram for helping me come up with this list<\/em><\/p>\n<p>Update: some people have contributed some great ssh tips on\u00a0<a href=\"http:\/\/news.ycombinator.com\/item?id=1536126\">Hacker News<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>From derwiki.tumblr.com How I Learned to Stop Worrying and Love SSH Before there were VPNs, there was ssh. And when you don\u2019t have access to your VPN or can\u2019t set one up, you can still get most of the functionality over ssh. Quick and dirty HTTP tunneling This is useful if you need to hit&#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"https:\/\/g33kinfo.com\/info\/ssh-infoz\/\">Read More<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-3377","post","type-post","status-publish","format-standard","hentry","category-info"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>SSH infoz - Linux Shtuff<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/g33kinfo.com\/info\/ssh-infoz\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SSH infoz - Linux Shtuff\" \/>\n<meta property=\"og:description\" content=\"From derwiki.tumblr.com How I Learned to Stop Worrying and Love SSH Before there were VPNs, there was ssh. And when you don\u2019t have access to your VPN or can\u2019t set one up, you can still get most of the functionality over ssh. Quick and dirty HTTP tunneling This is useful if you need to hit... Read More\" \/>\n<meta property=\"og:url\" content=\"https:\/\/g33kinfo.com\/info\/ssh-infoz\/\" \/>\n<meta property=\"og:site_name\" content=\"Linux Shtuff\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/fb.me\/g33kinf0\" \/>\n<meta property=\"article:author\" content=\"https:\/\/fb.me\/g33kinf0\" \/>\n<meta property=\"article:published_time\" content=\"2010-07-22T03:06:52+00:00\" \/>\n<meta name=\"author\" content=\"g33kadmin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/drsinger1111\" \/>\n<meta name=\"twitter:site\" content=\"@drsinger1111\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/ssh-infoz\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/ssh-infoz\\\/\"},\"author\":{\"name\":\"g33kadmin\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"headline\":\"SSH infoz\",\"datePublished\":\"2010-07-22T03:06:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/ssh-infoz\\\/\"},\"wordCount\":367,\"publisher\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"articleSection\":[\"General Info\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/ssh-infoz\\\/\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/ssh-infoz\\\/\",\"name\":\"SSH infoz - Linux Shtuff\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#website\"},\"datePublished\":\"2010-07-22T03:06:52+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/ssh-infoz\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/g33kinfo.com\\\/info\\\/ssh-infoz\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/ssh-infoz\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SSH infoz\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#website\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/\",\"name\":\"Linux Shtuff\",\"description\":\"Because I have CRS Syndrome...\",\"publisher\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\",\"name\":\"g33kadmin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"contentUrl\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"width\":512,\"height\":512,\"caption\":\"g33kadmin\"},\"logo\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\"},\"description\":\"I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com\\\/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....\",\"sameAs\":[\"https:\\\/\\\/thelinuxreport.com\",\"https:\\\/\\\/fb.me\\\/g33kinf0\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/drsinger1111\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SSH infoz - Linux Shtuff","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/g33kinfo.com\/info\/ssh-infoz\/","og_locale":"en_US","og_type":"article","og_title":"SSH infoz - Linux Shtuff","og_description":"From derwiki.tumblr.com How I Learned to Stop Worrying and Love SSH Before there were VPNs, there was ssh. And when you don\u2019t have access to your VPN or can\u2019t set one up, you can still get most of the functionality over ssh. Quick and dirty HTTP tunneling This is useful if you need to hit... Read More","og_url":"https:\/\/g33kinfo.com\/info\/ssh-infoz\/","og_site_name":"Linux Shtuff","article_publisher":"https:\/\/fb.me\/g33kinf0","article_author":"https:\/\/fb.me\/g33kinf0","article_published_time":"2010-07-22T03:06:52+00:00","author":"g33kadmin","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/drsinger1111","twitter_site":"@drsinger1111","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/g33kinfo.com\/info\/ssh-infoz\/#article","isPartOf":{"@id":"https:\/\/g33kinfo.com\/info\/ssh-infoz\/"},"author":{"name":"g33kadmin","@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"headline":"SSH infoz","datePublished":"2010-07-22T03:06:52+00:00","mainEntityOfPage":{"@id":"https:\/\/g33kinfo.com\/info\/ssh-infoz\/"},"wordCount":367,"publisher":{"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"articleSection":["General Info"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/g33kinfo.com\/info\/ssh-infoz\/","url":"https:\/\/g33kinfo.com\/info\/ssh-infoz\/","name":"SSH infoz - Linux Shtuff","isPartOf":{"@id":"https:\/\/g33kinfo.com\/info\/#website"},"datePublished":"2010-07-22T03:06:52+00:00","breadcrumb":{"@id":"https:\/\/g33kinfo.com\/info\/ssh-infoz\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/g33kinfo.com\/info\/ssh-infoz\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/g33kinfo.com\/info\/ssh-infoz\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/g33kinfo.com\/info\/"},{"@type":"ListItem","position":2,"name":"SSH infoz"}]},{"@type":"WebSite","@id":"https:\/\/g33kinfo.com\/info\/#website","url":"https:\/\/g33kinfo.com\/info\/","name":"Linux Shtuff","description":"Because I have CRS Syndrome...","publisher":{"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/g33kinfo.com\/info\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547","name":"g33kadmin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","url":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","contentUrl":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","width":512,"height":512,"caption":"g33kadmin"},"logo":{"@id":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif"},"description":"I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com\/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....","sameAs":["https:\/\/thelinuxreport.com","https:\/\/fb.me\/g33kinf0","https:\/\/x.com\/https:\/\/twitter.com\/drsinger1111"]}]}},"_links":{"self":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts\/3377","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/comments?post=3377"}],"version-history":[{"count":0,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts\/3377\/revisions"}],"wp:attachment":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/media?parent=3377"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/categories?post=3377"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/tags?post=3377"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}