adamsgaard.dk

my academic webpage
git clone git://src.adamsgaard.dk/adamsgaard.dk # fast
git clone https://src.adamsgaard.dk/adamsgaard.dk.git # slow
Log | Files | Refs | README | LICENSE Back to index

commit db3807a0b7a4617410c13e4b34a262dcb02a879a
parent 3d728665c7ec2a79d7098c5a3794892ec9797054
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Thu, 17 Dec 2020 15:23:54 +0100

ssh-tunnels: add PS1 to code snippets meant for terminal

Diffstat:
Mpages/007-ssh-tunnels.html | 8++++----
Mpages/007-ssh-tunnels.txt | 8++++----
2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/pages/007-ssh-tunnels.html b/pages/007-ssh-tunnels.html @@ -60,7 +60,7 @@ it is easy to create a tunnel that connects the outside computer with the internal network via SSH. The following command creates the tunnel when executed on the outside computer:</p> -<pre><code>ssh -D 1337 -C -N company-domain.com +<pre><code>$ ssh -D 1337 -C -N company-domain.com </code></pre> <p>Note that the port number specified with the -D option should be @@ -101,7 +101,7 @@ reverse ssh tunnel and utilize it in a similar manner as in the previous scenario. On the office computer, create a reverse tunnel to the outside server:</p> -<pre><code>ssh -f -N -R 10022:localhost:22 outside-server.com +<pre><code>$ ssh -f -N -R 10022:localhost:22 outside-server.com </code></pre> <p>As long as the above command runs, you can initiate new SSH connections @@ -118,13 +118,13 @@ on the outside laptop:</p> <p>With the above configuration, it is very easy to establish a SSH connection from the outside laptop to the office computer:</p> -<pre><code>ssh office_computer +<pre><code>$ ssh office_computer </code></pre> <p>As in the previous example, you can use this setup to create a SSH tunnel all the way from the outside laptop to the office computer:</p> -<pre><code>ssh -D 1337 -C -N office_computer +<pre><code>$ ssh -D 1337 -C -N office_computer </code></pre> <p>Again, this creates a SOCKSv5 proxy that you can use for tunneling diff --git a/pages/007-ssh-tunnels.txt b/pages/007-ssh-tunnels.txt @@ -58,7 +58,7 @@ it is easy to create a tunnel that connects the outside computer with the internal network via SSH. The following command creates the tunnel when executed on the outside computer: - ssh -D 1337 -C -N company-domain.com + $ ssh -D 1337 -C -N company-domain.com Note that the port number specified with the -D option should be greater than 1000 when running as an unpriviledged (non-root) user. @@ -97,7 +97,7 @@ reverse ssh tunnel and utilize it in a similar manner as in the previous scenario. On the office computer, create a reverse tunnel to the outside server: - ssh -f -N -R 10022:localhost:22 outside-server.com + $ ssh -f -N -R 10022:localhost:22 outside-server.com As long as the above command runs, you can initiate new SSH connections from the outside server to the office computer with the command @@ -112,12 +112,12 @@ on the outside laptop: With the above configuration, it is very easy to establish a SSH connection from the outside laptop to the office computer: - ssh office_computer + $ ssh office_computer As in the previous example, you can use this setup to create a SSH tunnel all the way from the outside laptop to the office computer: - ssh -D 1337 -C -N office_computer + $ ssh -D 1337 -C -N office_computer Again, this creates a SOCKSv5 proxy that you can use for tunneling network traffic from the outside laptop to the closed network. It