myhelp:bash
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| myhelp:bash [2026/04/22 11:47] – ulrich | myhelp:bash [2026/04/22 11:48] (current) – ulrich | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== |
| - | + | ||
| - | Mehr Infos was man mit SSH alles machen kann, findet ihr [[https:// | + | |
| - | + | ||
| - | ===== how to loginfreies ssh: ===== | + | |
| < | < | ||
| - | ssh-keygen -t ecdsa | + | # while read line; do echo " |
| - | cat .ssh/ | + | |
| - | ssh-copy-id -i ~/ | + | |
| </ | </ | ||
| - | –> auf alle Server kopieren die man ohne passwort betreten will. For der openssh Version 5.6 können noch kein ecdsa-Keys verwendet werden. Es müssen daher die " | + | ====== Upper to Lower ====== |
| - | ==== Schlüssel sichern ==== | + | Is pretty easy done |
| - | + | ||
| - | Wenn man einen Schlüssel erzeugt hat und ihn ohne Passphrase schützt, kann man am Server noch eine weitere Sicherheitseinstellung vornehmen. | + | |
| < | < | ||
| - | from=" | + | # cat / |
| </ | </ | ||
| - | Das wird einfach vor dem Schlüssel im .ssh/ | + | or |
| - | + | ||
| - | ssh mit timeout | + | |
| < | < | ||
| - | ssh -o ConnectTimeout=10 | + | # echo " |
| </ | </ | ||
| - | ===== .ssh/ | + | ====== SED Examples ====== |
| - | Ein Beispiel für die ssh Konfiguration: | + | Delete a line with a string in it. For example old ssh-keys: |
| < | < | ||
| - | Host server | + | # sed -i "/ |
| - | HostName 11.22.33.44 | + | |
| - | User myname | + | |
| - | Port 22 | + | |
| - | + | ||
| - | Host * | + | |
| - | ForwardX11 yes | + | |
| - | ServerAliveInterval 30 | + | |
| </ | </ | ||
| - | ===== Reverse-Tunnel | + | ====== Calculate ====== |
| - | Auf die Maschine(serverA) auf die man zugreifen will: | + | You can use the expr |
| < | < | ||
| - | ssh -R 4321: | + | # expr 1 + 2 |
| </ | </ | ||
| - | Danach kann man von serverA mit | + | and you will get 3 as result. |
| + | |||
| + | Also some more fancy stuff is possible. For example in a for-loop: | ||
| < | < | ||
| - | ssh -p4321 localhost | + | for i in {1..9}; do echo " |
| </ | </ | ||
| - | auf serverB zugreifen oder je nach dem welcher Port Forgewarded wird auf diverse andere Dienste zugreifen. | + | ====== Bash redirection ====== |
| - | Das ganze jetzt noch über einen Jumphost | + | stdout to file |
| < | < | ||
| - | ssh -R 1234:127.0.0.1:22 jumphost -t ssh -p 4321 -R 1234: | + | # command > file.txt |
| </ | </ | ||
| - | ===== SOCKS proxy via a second Host ===== | + | stderr to file |
| - | Einen SOSCKS-Proxy über einen Jumphost öffnen. | + | < |
| + | # command 2> /dev/null | ||
| + | </ | ||
| + | |||
| + | stdout AND stderr to file | ||
| < | < | ||
| - | ssh -L 8001: | + | # command &> file.txt |
| </ | </ | ||
| - | Der erste Port(8001) ist der, der lokal als Proxy-Port genutzt wird. Der Zweite wird nur mit zu Kommunikation zwischen Jumphost und dem eigenltich SOCKS benötigt. | + | stdout to file AND stderr to file |
| - | ===== X11 Forward ===== | + | < |
| + | # command > file.txt 2> /dev/null | ||
| + | </ | ||
| - | Das ist eigentlich recht simpel: | + | stdout to stderr |
| < | < | ||
| - | ssh -X server | + | # command 1>&2 |
| </ | </ | ||
| - | Nach einer Minimalinstallation sind auf dem Server keinerlei Sachen für eine Handhanbung über GUI's installiert. Wenn man also via ssh ein Programm aufruft fehlen auch die entprechenden Fonts. Darum empfiehlt es sich folgendes Paket zu installieren: | + | stderr to stdout |
| < | < | ||
| - | yum install dejavu-lgc-sans-fonts.noarch -y | + | # command 2>&1 |
| </ | </ | ||
myhelp/bash.1776858455.txt.gz · Last modified: by ulrich · Currently locked by: 216.73.216.196
