jekyll build from Action 6df8913247
This commit is contained in:
parent
47222023f5
commit
a6ef280026
@ -402,6 +402,53 @@ So here I am and welcome to my first blog. Having a personal space on the Intern
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2022/02/26/ssh-into-machine-that-is-behind-private-network.html" rel="permalink">SSH into Machine That Is Behind a Private Network
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2022-02-26T21:40:00+00:00">February 26, 2022</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
2 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">Story
|
||||
I believe there is always a “tech support person” in every home. Everyone knows that when there is a problem with any electronic device, they should as...</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
|
@ -430,6 +430,53 @@ util.lua: highlight<span class="o">(</span>group, properties<span class="o">)
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2022/02/26/ssh-into-machine-that-is-behind-private-network.html" rel="permalink">SSH into Machine That Is Behind a Private Network
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2022-02-26T21:40:00+00:00">February 26, 2022</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
2 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">Story
|
||||
I believe there is always a “tech support person” in every home. Everyone knows that when there is a problem with any electronic device, they should as...</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
|
@ -552,6 +552,53 @@ WantedBy=multi-user.target
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2022/02/26/ssh-into-machine-that-is-behind-private-network.html" rel="permalink">SSH into Machine That Is Behind a Private Network
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2022-02-26T21:40:00+00:00">February 26, 2022</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
2 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">Story
|
||||
I believe there is always a “tech support person” in every home. Everyone knows that when there is a problem with any electronic device, they should as...</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
|
@ -371,7 +371,8 @@ ffmpeg <span class="nt">-f</span> concat <span class="nt">-i</span> mylist.txt <
|
||||
">Previous</a>
|
||||
|
||||
|
||||
<a href="#" class="pagination--pager disabled">Next</a>
|
||||
<a href="/2022/02/26/ssh-into-machine-that-is-behind-private-network.html" class="pagination--pager" title="SSH into Machine That Is Behind a Private Network
|
||||
">Next</a>
|
||||
|
||||
</nav>
|
||||
|
||||
@ -390,6 +391,53 @@ ffmpeg <span class="nt">-f</span> concat <span class="nt">-i</span> mylist.txt <
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2022/02/26/ssh-into-machine-that-is-behind-private-network.html" rel="permalink">SSH into Machine That Is Behind a Private Network
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2022-02-26T21:40:00+00:00">February 26, 2022</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
2 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">Story
|
||||
I believe there is always a “tech support person” in every home. Everyone knows that when there is a problem with any electronic device, they should as...</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
|
659
2022/02/26/ssh-into-machine-that-is-behind-private-network.html
Normal file
659
2022/02/26/ssh-into-machine-that-is-behind-private-network.html
Normal file
@ -0,0 +1,659 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
Minimal Mistakes Jekyll Theme 4.24.0 by Michael Rose
|
||||
Copyright 2013-2020 Michael Rose - mademistakes.com | @mmistakes
|
||||
Free for personal and commercial use under the MIT license
|
||||
https://github.com/mmistakes/minimal-mistakes/blob/master/LICENSE
|
||||
-->
|
||||
<html lang="en" class="no-js">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<!-- begin _includes/seo.html --><title>SSH into Machine That Is Behind a Private Network - Şahin Akkaya’s Personal Page</title>
|
||||
<meta name="description" content="Story I believe there is always a “tech support person” in every home. Everyone knows that when there is a problem with any electronic device, they should ask this person. I am the tech support in our house. Today, I had to fix a problem in our desktop. Since I was not at home, I had to fix the problem remotely.">
|
||||
|
||||
|
||||
<meta name="author" content="Şahin Akkaya">
|
||||
|
||||
<meta property="article:author" content="Şahin Akkaya">
|
||||
|
||||
|
||||
|
||||
<meta property="og:type" content="article">
|
||||
<meta property="og:locale" content="en_US">
|
||||
<meta property="og:site_name" content="Şahin Akkaya's Personal Page">
|
||||
<meta property="og:title" content="SSH into Machine That Is Behind a Private Network">
|
||||
<meta property="og:url" content="https://sahinakkaya.dev/2022/02/26/ssh-into-machine-that-is-behind-private-network.html">
|
||||
|
||||
|
||||
<meta property="og:description" content="Story I believe there is always a “tech support person” in every home. Everyone knows that when there is a problem with any electronic device, they should ask this person. I am the tech support in our house. Today, I had to fix a problem in our desktop. Since I was not at home, I had to fix the problem remotely.">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta property="article:published_time" content="2022-02-26T21:40:00+00:00">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="canonical" href="https://sahinakkaya.dev/2022/02/26/ssh-into-machine-that-is-behind-private-network.html">
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
|
||||
"@type": "Person",
|
||||
"name": null,
|
||||
"url": "https://sahinakkaya.dev/"
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- end _includes/seo.html -->
|
||||
|
||||
|
||||
|
||||
<link href="/feed.xml" type="application/atom+xml" rel="alternate" title="Şahin Akkaya's Personal Page Feed">
|
||||
|
||||
|
||||
<!-- https://t.co/dKP3o1e -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<script>
|
||||
document.documentElement.className = document.documentElement.className.replace(/\bno-js\b/g, '') + ' js ';
|
||||
</script>
|
||||
|
||||
<!-- For all browsers -->
|
||||
<link rel="stylesheet" href="/assets/css/main.css">
|
||||
<link rel="preload" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5/css/all.min.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
|
||||
<noscript><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5/css/all.min.css"></noscript>
|
||||
|
||||
|
||||
|
||||
<!-- start custom head snippets -->
|
||||
|
||||
<!-- insert favicons. use https://realfavicongenerator.net/ -->
|
||||
|
||||
<!-- end custom head snippets -->
|
||||
|
||||
</head>
|
||||
|
||||
<body class="layout--single">
|
||||
<nav class="skip-links">
|
||||
<ul>
|
||||
<li><a href="#site-nav" class="screen-reader-shortcut">Skip to primary navigation</a></li>
|
||||
<li><a href="#main" class="screen-reader-shortcut">Skip to content</a></li>
|
||||
<li><a href="#footer" class="screen-reader-shortcut">Skip to footer</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<!--[if lt IE 9]>
|
||||
<div class="notice--danger align-center" style="margin: 0;">You are using an <strong>outdated</strong> browser. Please <a href="https://browsehappy.com/">upgrade your browser</a> to improve your experience.</div>
|
||||
<![endif]-->
|
||||
|
||||
|
||||
|
||||
<div class="masthead">
|
||||
<div class="masthead__inner-wrap">
|
||||
<div class="masthead__menu">
|
||||
<nav id="site-nav" class="greedy-nav">
|
||||
|
||||
<a class="site-title" href="/">
|
||||
/home/sahin/
|
||||
|
||||
</a>
|
||||
<ul class="visible-links"><li class="masthead__menu-item">
|
||||
<a href="/">Home</a>
|
||||
</li><li class="masthead__menu-item">
|
||||
<a href="/about/">About</a>
|
||||
</li><li class="masthead__menu-item">
|
||||
<a href="/contact/">Contact</a>
|
||||
</li></ul>
|
||||
|
||||
<button class="search__toggle" type="button">
|
||||
<span class="visually-hidden">Toggle search</span>
|
||||
<i class="fas fa-search"></i>
|
||||
</button>
|
||||
|
||||
<button class="greedy-nav__toggle hidden" type="button">
|
||||
<span class="visually-hidden">Toggle menu</span>
|
||||
<div class="navicon"></div>
|
||||
</button>
|
||||
<ul class="hidden-links hidden"></ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="initial-content">
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="main" role="main">
|
||||
|
||||
<div class="sidebar sticky">
|
||||
|
||||
|
||||
|
||||
<div itemscope itemtype="https://schema.org/Person">
|
||||
|
||||
|
||||
<div class="author__avatar">
|
||||
|
||||
<img src="/assets/images/logo.jpg" alt="Şahin Akkaya" itemprop="image">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="author__content">
|
||||
|
||||
<h3 class="author__name" itemprop="name">Şahin Akkaya</h3>
|
||||
|
||||
|
||||
<div class="author__bio" itemprop="description">
|
||||
<p>A perfectionist who likes to tinker everything until it is just right.</p>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="author__urls-wrapper">
|
||||
<button class="btn btn--inverse">Follow</button>
|
||||
<ul class="author__urls social-icons">
|
||||
|
||||
<li itemprop="homeLocation" itemscope itemtype="https://schema.org/Place">
|
||||
<i class="fas fa-fw fa-map-marker-alt" aria-hidden="true"></i> <span itemprop="name">Istanbul, Turkey</span>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li><a href="https://github.com/Asocia" rel="nofollow noopener noreferrer"><i class="fab fa-fw fa-github" aria-hidden="true"></i><span class="label">Asocia</span></a></li>
|
||||
|
||||
|
||||
|
||||
<li><a href="https://stackoverflow.com/users/9608759" rel="nofollow noopener noreferrer"><i class="fab fa-fw fa-stack-overflow" aria-hidden="true"></i><span class="label">Asocia</span></a></li>
|
||||
|
||||
|
||||
|
||||
<li><a href="https://twitter.com/sahinakkayadev" rel="nofollow noopener noreferrer"><i class="fab fa-fw fa-twitter-square" aria-hidden="true"></i><span class="label">@sahinakkayadev</span></a></li>
|
||||
|
||||
|
||||
|
||||
<li><a href="mailto:sahin@sahinakkaya.dev" rel="nofollow noopener noreferrer"><i class="fas fa-fw fa-envelope" aria-hidden="true"></i><span class="label">sahin@sahinakkaya.dev</span></a></li>
|
||||
|
||||
|
||||
|
||||
<li><a href="/assets/docs/resume.pdf" rel="nofollow noopener noreferrer"><i class="fas fa-fw fa-id-card" aria-hidden="true"></i><span class="label">Resume</span></a></li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
<li>
|
||||
<a href="http://link-to-whatever-social-network.com/user/" itemprop="sameAs" rel="nofollow noopener noreferrer">
|
||||
<i class="fas fa-fw" aria-hidden="true"></i> Custom Social Profile Link
|
||||
</a>
|
||||
</li>
|
||||
-->
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<article class="page" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
<meta itemprop="headline" content="SSH into Machine That Is Behind a Private Network">
|
||||
<meta itemprop="description" content="StoryI believe there is always a “tech support person” in every home. Everyone knows that when there is a problem with any electronic device, they should ask this person. I am the tech support in our house. Today, I had to fix a problem in our desktop. Since I was not at home, I had to fix the problem remotely.">
|
||||
<meta itemprop="datePublished" content="2022-02-26T21:40:00+00:00">
|
||||
|
||||
|
||||
<div class="page__inner-wrap">
|
||||
|
||||
<header>
|
||||
<h1 id="page-title" class="page__title" itemprop="headline">SSH into Machine That Is Behind a Private Network
|
||||
</h1>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2022-02-26T21:40:00+00:00">February 26, 2022</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-clock" aria-hidden="true"></i>
|
||||
|
||||
2 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
|
||||
<section class="page__content" itemprop="text">
|
||||
|
||||
<h2 id="story">Story</h2>
|
||||
<p>I believe there is always a “tech support person” in every home. Everyone knows that when there is a problem with any electronic device, they should ask this person. I am the tech support in our house. Today, I had to fix a problem in our desktop. Since I was not at home, I had to fix the problem remotely.</p>
|
||||
|
||||
<h2 id="possible-solutions">Possible solutions</h2>
|
||||
<ul>
|
||||
<li>
|
||||
<p>Just tell the non-tech people at home to configure the router to forward ssh traffic to desktop, right? Well, this is not an option for me, not because people are non-tech, but there is no router! The desktop is connected to internet via hotspot from mobile phone. There is no root access in the phone and even if there was, it is a really big pain to forward the packets manually. Trust me. Been there, done that!</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>There are tools like <a href="https://www.ngrok.com">ngrok</a>, <a href="localtunnel.me">localtunnel</a> which exposes your localhost to the internet and gives you a URL to access it but I did not want to use them.</p>
|
||||
<ul>
|
||||
<li>I did not want to use <code class="language-plaintext highlighter-rouge">ngrok</code> because it is not open source and it might have security issues. They are also charging you.</li>
|
||||
<li><code class="language-plaintext highlighter-rouge">localtunnel</code> seemed perfect. The code of both client and server is open. That is great news! But it did not last long because it is just forwarding http/https traffic :(</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="solution">Solution</h2>
|
||||
<p>I was thinking of extending the functionality of <code class="language-plaintext highlighter-rouge">localtunnel</code>, but I learned a very simple way. You don’t need any external program to overcome this issue. The good old <code class="language-plaintext highlighter-rouge">ssh</code> can do that! All you need is another machine (a remote server) that both computers can access via ssh.</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># local machine (my home computer)</span>
|
||||
ssh <span class="nt">-R</span> 7777:localhost:22 remote-user@remote.host
|
||||
</code></pre></div></div>
|
||||
<p>This command forwards all the incoming connections to port 7777 of remote machine to port 22 of our current machine. In order for this to work, you need to make sure <code class="language-plaintext highlighter-rouge">GatewayPorts</code> is set to <code class="language-plaintext highlighter-rouge">yes</code> in the remote server ssh configuration. It also assumes our current machine accepts ssh connections via port 22.</p>
|
||||
|
||||
<hr />
|
||||
<p>Now, go to any machine and connect to the remote server first. When we are connected, we will create another ssh connection to port 7777 to connect our home computer.</p>
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># another local machine (my laptop)</span>
|
||||
ssh remote-user@remote.host
|
||||
|
||||
<span class="c"># connected remote</span>
|
||||
ssh <span class="nt">-p</span> 7777 homeuser@localhost
|
||||
<span class="c"># we are now connected to home computer</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>The last two command can also combined so that we directly hop into the home computer.</p>
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ssh <span class="nt">-t</span> remote-user@remote.host ssh <span class="nt">-p</span> 7777 homeuser@localhost
|
||||
</code></pre></div></div>
|
||||
|
||||
<h3 id="result">Result</h3>
|
||||
<p>As a result, it only took us 2 simple ssh commands to do this. This is just unbelievable! Now, I need to find a way to make non-tech people at home run this command when there is a problem. Too bad Linux can’t help me there :D</p>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
<footer class="page__meta">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p class="page__date"><strong><i class="fas fa-fw fa-calendar-alt" aria-hidden="true"></i> Updated:</strong> <time datetime="2022-02-26T21:40:00+00:00">February 26, 2022</time></p>
|
||||
|
||||
|
||||
</footer>
|
||||
|
||||
<section class="page__share">
|
||||
|
||||
|
||||
<a href="https://twitter.com/intent/tweet?text=SSH+into+Machine+That+Is+Behind+a+Private+Network%20https%3A%2F%2Fsahinakkaya.dev%2F2022%2F02%2F26%2Fssh-into-machine-that-is-behind-private-network.html" class="btn btn--twitter" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="Share on Twitter"><i class="fab fa-fw fa-twitter" aria-hidden="true"></i><span> Twitter</span></a>
|
||||
|
||||
<a href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fsahinakkaya.dev%2F2022%2F02%2F26%2Fssh-into-machine-that-is-behind-private-network.html" class="btn btn--facebook" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="Share on Facebook"><i class="fab fa-fw fa-facebook" aria-hidden="true"></i><span> Facebook</span></a>
|
||||
|
||||
<a href="https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fsahinakkaya.dev%2F2022%2F02%2F26%2Fssh-into-machine-that-is-behind-private-network.html" class="btn btn--linkedin" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="Share on LinkedIn"><i class="fab fa-fw fa-linkedin" aria-hidden="true"></i><span> LinkedIn</span></a>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<nav class="pagination">
|
||||
|
||||
<a href="/2022/01/21/ffmpeg-to-rescue.html" class="pagination--pager" title="Using ffmpeg for Simple Video Editing
|
||||
">Previous</a>
|
||||
|
||||
|
||||
<a href="#" class="pagination--pager disabled">Next</a>
|
||||
|
||||
</nav>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
|
||||
<div class="page__related">
|
||||
<h4 class="page__related-title">You May Also Enjoy</h4>
|
||||
<div class="grid__wrapper">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2022/01/21/ffmpeg-to-rescue.html" rel="permalink">Using ffmpeg for Simple Video Editing
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2022-01-21T20:40:00+00:00">January 21, 2022</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
1 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">Story
|
||||
Today, I have recorded a video for one of my classes and I was required to upload it till midnight. The video was perfect except for a few seconds wher...</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2022/01/04/build-and-deploy-automatically.html" rel="permalink">Automatically Build and Deploy Your Site using GitHub Actions and Webhooks
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2022-01-04T17:40:00+00:00">January 4, 2022</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
5 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">In this post I will explain how you can use GitHub to automate the build and deployment processes that you have. I am going to automate the deployment of thi...</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2022/01/01/stop-cat-pipeing.html" rel="permalink">Stop cat-pipe’ing, You Are Doing It Wrong!
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2022-01-01T15:00:00+00:00">January 1, 2022</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
2 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">cat some_file | grep some_pattern
|
||||
|
||||
I’m sure that you run a command something like above at least once if you are using terminal. You know how cat and grep wo...</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2021/12/24/first-blog-post.html" rel="permalink">First blog post
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2021-12-24T23:54:08+00:00">December 24, 2021</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
3 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">Hello, World!* So here I am and welcome to my first blog. Having a personal space on the Internet has been a dream for me for years and I am happy that it fi…
|
||||
</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="search-content">
|
||||
<div class="search-content__inner-wrap"><form class="search-content__form" onkeydown="return event.key != 'Enter';">
|
||||
<label class="sr-only" for="search">
|
||||
Enter your search term...
|
||||
</label>
|
||||
<input type="search" id="search" class="search-input" tabindex="-1" placeholder="Enter your search term..." />
|
||||
</form>
|
||||
<div id="results" class="results"></div></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="footer" class="page__footer">
|
||||
<footer>
|
||||
<!-- start custom footer snippets -->
|
||||
|
||||
<!-- end custom footer snippets -->
|
||||
<div class="page__footer-follow">
|
||||
<ul class="social-icons">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li><a href="/feed.xml"><i class="fas fa-fw fa-rss-square" aria-hidden="true"></i> Feed</a></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="page__footer-copyright">© 2022 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">
|
||||
Check out the <a href="https://github.com/Asocia/sahinakkayadotdev">code</a> of this site.
|
||||
</div>
|
||||
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="/assets/js/main.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="/assets/js/lunr/lunr.min.js"></script>
|
||||
<script src="/assets/js/lunr/lunr-store.js"></script>
|
||||
<script src="/assets/js/lunr/lunr-en.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -22,4 +22,10 @@ var store = [{
|
||||
"tags": ["cli","ffmpeg"],
|
||||
"url": "/2022/01/21/ffmpeg-to-rescue.html",
|
||||
"teaser": null
|
||||
},{
|
||||
"title": "SSH into Machine That Is Behind a Private Network",
|
||||
"excerpt":"Story I believe there is always a “tech support person” in every home. Everyone knows that when there is a problem with any electronic device, they should ask this person. I am the tech support in our house. Today, I had to fix a problem in our desktop. Since I...","categories": [],
|
||||
"tags": ["ssh","private-network","remote-port-forwarding"],
|
||||
"url": "/2022/02/26/ssh-into-machine-that-is-behind-private-network.html",
|
||||
"teaser": null
|
||||
}]
|
||||
|
42
feed.xml
42
feed.xml
@ -1,4 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.2.1">Jekyll</generator><link href="https://sahinakkaya.dev/feed.xml" rel="self" type="application/atom+xml" /><link href="https://sahinakkaya.dev/" rel="alternate" type="text/html" /><updated>2022-02-05T10:38:02+00:00</updated><id>https://sahinakkaya.dev/feed.xml</id><title type="html">Şahin Akkaya’s Personal Page</title><subtitle>Şahin Akkaya's personal blog - a perfectionist who likes to tinker everything until it is just right. Get ready to find some sweet tips that will boost your productivity and make you fall in love with your computer.</subtitle><author><name>Şahin Akkaya</name></author><entry><title type="html">Using ffmpeg for Simple Video Editing</title><link href="https://sahinakkaya.dev/2022/01/21/ffmpeg-to-rescue.html" rel="alternate" type="text/html" title="Using ffmpeg for Simple Video Editing" /><published>2022-01-21T20:40:00+00:00</published><updated>2022-01-21T20:40:00+00:00</updated><id>https://sahinakkaya.dev/2022/01/21/ffmpeg-to-rescue</id><content type="html" xml:base="https://sahinakkaya.dev/2022/01/21/ffmpeg-to-rescue.html"><h2 id="story">Story</h2>
|
||||
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.2.1">Jekyll</generator><link href="https://sahinakkaya.dev/feed.xml" rel="self" type="application/atom+xml" /><link href="https://sahinakkaya.dev/" rel="alternate" type="text/html" /><updated>2022-02-27T05:08:20+00:00</updated><id>https://sahinakkaya.dev/feed.xml</id><title type="html">Şahin Akkaya’s Personal Page</title><subtitle>Şahin Akkaya's personal blog - a perfectionist who likes to tinker everything until it is just right. Get ready to find some sweet tips that will boost your productivity and make you fall in love with your computer.</subtitle><author><name>Şahin Akkaya</name></author><entry><title type="html">SSH into Machine That Is Behind a Private Network</title><link href="https://sahinakkaya.dev/2022/02/26/ssh-into-machine-that-is-behind-private-network.html" rel="alternate" type="text/html" title="SSH into Machine That Is Behind a Private Network" /><published>2022-02-26T21:40:00+00:00</published><updated>2022-02-26T21:40:00+00:00</updated><id>https://sahinakkaya.dev/2022/02/26/ssh-into-machine-that-is-behind-private-network</id><content type="html" xml:base="https://sahinakkaya.dev/2022/02/26/ssh-into-machine-that-is-behind-private-network.html"><h2 id="story">Story</h2>
|
||||
<p>I believe there is always a “tech support person” in every home. Everyone knows that when there is a problem with any electronic device, they should ask this person. I am the tech support in our house. Today, I had to fix a problem in our desktop. Since I was not at home, I had to fix the problem remotely.</p>
|
||||
|
||||
<h2 id="possible-solutions">Possible solutions</h2>
|
||||
<ul>
|
||||
<li>
|
||||
<p>Just tell the non-tech people at home to configure the router to forward ssh traffic to desktop, right? Well, this is not an option for me, not because people are non-tech, but there is no router! The desktop is connected to internet via hotspot from mobile phone. There is no root access in the phone and even if there was, it is a really big pain to forward the packets manually. Trust me. Been there, done that!</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>There are tools like <a href="https://www.ngrok.com">ngrok</a>, <a href="localtunnel.me">localtunnel</a> which exposes your localhost to the internet and gives you a URL to access it but I did not want to use them.</p>
|
||||
<ul>
|
||||
<li>I did not want to use <code class="language-plaintext highlighter-rouge">ngrok</code> because it is not open source and it might have security issues. They are also charging you.</li>
|
||||
<li><code class="language-plaintext highlighter-rouge">localtunnel</code> seemed perfect. The code of both client and server is open. That is great news! But it did not last long because it is just forwarding http/https traffic :(</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="solution">Solution</h2>
|
||||
<p>I was thinking of extending the functionality of <code class="language-plaintext highlighter-rouge">localtunnel</code>, but I learned a very simple way. You don’t need any external program to overcome this issue. The good old <code class="language-plaintext highlighter-rouge">ssh</code> can do that! All you need is another machine (a remote server) that both computers can access via ssh.</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># local machine (my home computer)</span>
|
||||
ssh <span class="nt">-R</span> 7777:localhost:22 remote-user@remote.host
|
||||
</code></pre></div></div>
|
||||
<p>This command forwards all the incoming connections to port 7777 of remote machine to port 22 of our current machine. In order for this to work, you need to make sure <code class="language-plaintext highlighter-rouge">GatewayPorts</code> is set to <code class="language-plaintext highlighter-rouge">yes</code> in the remote server ssh configuration. It also assumes our current machine accepts ssh connections via port 22.</p>
|
||||
|
||||
<hr />
|
||||
<p>Now, go to any machine and connect to the remote server first. When we are connected, we will create another ssh connection to port 7777 to connect our home computer.</p>
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># another local machine (my laptop)</span>
|
||||
ssh remote-user@remote.host
|
||||
|
||||
<span class="c"># connected remote</span>
|
||||
ssh <span class="nt">-p</span> 7777 homeuser@localhost
|
||||
<span class="c"># we are now connected to home computer</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>The last two command can also combined so that we directly hop into the home computer.</p>
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ssh <span class="nt">-t</span> remote-user@remote.host ssh <span class="nt">-p</span> 7777 homeuser@localhost
|
||||
</code></pre></div></div>
|
||||
|
||||
<h3 id="result">Result</h3>
|
||||
<p>As a result, it only took us 2 simple ssh commands to do this. This is just unbelievable! Now, I need to find a way to make non-tech people at home run this command when there is a problem. Too bad Linux can’t help me there :D</p></content><author><name>Şahin Akkaya</name></author><category term="ssh" /><category term="private-network" /><category term="remote-port-forwarding" /><summary type="html">Story I believe there is always a “tech support person” in every home. Everyone knows that when there is a problem with any electronic device, they should ask this person. I am the tech support in our house. Today, I had to fix a problem in our desktop. Since I was not at home, I had to fix the problem remotely.</summary></entry><entry><title type="html">Using ffmpeg for Simple Video Editing</title><link href="https://sahinakkaya.dev/2022/01/21/ffmpeg-to-rescue.html" rel="alternate" type="text/html" title="Using ffmpeg for Simple Video Editing" /><published>2022-01-21T20:40:00+00:00</published><updated>2022-01-21T20:40:00+00:00</updated><id>https://sahinakkaya.dev/2022/01/21/ffmpeg-to-rescue</id><content type="html" xml:base="https://sahinakkaya.dev/2022/01/21/ffmpeg-to-rescue.html"><h2 id="story">Story</h2>
|
||||
<p>Today, I have recorded a video for one of my classes and I was required to upload it till midnight. The video was perfect except for a few seconds where I misspelled some words and started again. I had to remove that part from the video before uploading it. Since I was low on time, I thought that I better use a GUI program to do this job. I opened up <a href="https://kdenlive.org/en/">Kdenlive</a> and jumped into editing my video. It was my first time using it so I spent some time to cut and delete the parts that I want to get rid of. When I was ready, I clicked Render button to render my video. It was waaay too slow than I expected. Since I have nothing to do while waiting for render to finish, I thought I could give <code class="language-plaintext highlighter-rouge">ffmpeg</code> a shot.</p>
|
||||
|
||||
<h2 id="let-the-show-begin">Let the show begin</h2>
|
||||
|
47
index.html
47
index.html
@ -284,6 +284,53 @@
|
||||
|
||||
|
||||
|
||||
<div class="list__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2022/02/26/ssh-into-machine-that-is-behind-private-network.html" rel="permalink">SSH into Machine That Is Behind a Private Network
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2022-02-26T21:40:00+00:00">February 26, 2022</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-clock" aria-hidden="true"></i>
|
||||
|
||||
2 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">Story
|
||||
I believe there is always a “tech support person” in every home. Everyone knows that when there is a problem with any electronic device, they should as...</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="list__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
|
@ -17,6 +17,10 @@
|
||||
<lastmod>2022-01-21T20:40:00+00:00</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://sahinakkaya.dev/2022/02/26/ssh-into-machine-that-is-behind-private-network.html</loc>
|
||||
<lastmod>2022-02-26T21:40:00+00:00</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://sahinakkaya.dev/about/</loc>
|
||||
</url>
|
||||
<url>
|
||||
@ -27,6 +31,6 @@
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://sahinakkaya.dev/assets/docs/resume.pdf</loc>
|
||||
<lastmod>2022-02-05T10:37:55+00:00</lastmod>
|
||||
<lastmod>2022-02-27T05:03:18+00:00</lastmod>
|
||||
</url>
|
||||
</urlset>
|
||||
|
Loading…
Reference in New Issue
Block a user