Projekt

Allgemein

Profil

Howto ssh » Historie » Version 2

Jeremias Keihsler, 17.01.2020 11:06

1 1 Jeremias Keihsler
h1. ssh
2
3
*ssh* is installed by default
4
5
h2. basic ssh usage
6
7
the most *nix-style way of getting help for @ssh@ is @man ssh@. 
8
I assume that the @ssh@ port is @22@ and the involved firewalls are setup accordingly.
9
<pre><code class="bash">
10
ssh user@example.com
11
</code></pre>
12
13
h2. ssh usage through another machine
14
15
What if you can't reach a machine directly but through a machine in between?
16
17
Of course you could @ssh@ twice, more compact form is:
18
<pre><code class="bash">
19
ssh -t user@reachable ssh user@unreachable
20
</code></pre>
21
22
h2. X-session access
23
24
<pre><code class="bash">
25
ssh -X user@example.com
26
</code></pre>
27
starting a X-program inside the remote shell will bring up a local X-window.
28
<pre><code class="bash">
29
baobab
30
</code></pre>
31
32
h2. Port forwarding to local machine
33
34
the following command will forward port 3390 (e.g. @vrpd@) on @example.com@ to local 3501.
35
36
This is useful when a given port is only accessible local on a remote machine but not accessible from outside.
37
<pre><code class="bash">
38
ssh -L 3501:localhost:3390 user@example.com
39
</code></pre>
40
now you can connect to the e.g. remote @vrdp@-session by simply on your local machine.
41
<pre><code class="bash">
42
rdesktop-vrdp -kde localhost:3501
43
</code></pre>
44
45
h2. "dynamic tunnel port" for use as socks.proxy
46
47 2 Jeremias Keihsler
sometimes a VPN is kind of an overkill, so if you only need to access local http-ressources from outside and can establish an SSH-connection from outside, this is a nice solution.
48 1 Jeremias Keihsler
49
<pre><code class="bash">
50
ssh -N -D2000 user@example.com
51
</code></pre>
52
53 2 Jeremias Keihsler
The parameter -N prevents an interactive shell, the parameter -D defines the local port for the dynamic tunnel. This port should be chosen above 1023, so you don't need root-access.
54 1 Jeremias Keihsler
55
!Firefox_SocksProxy_settings.png!