C - Client - kann beliebiger Benutzer sein
S - Server - muss unter root (weil Ports unter 1000 zugegriffen werden)
1. C:
ssh-keygen -t rsa -b 4096 cat /root/.ssh/id_rsa.pub→ Public Key in 2. nutzen
2. S
nano /root/.ssh/authorized_keys nano /etc/ssh/sshd_config
GatewayPorts yes ClientAliveInterval 60 ClientAliveCountMax 2
netstat -tulpn→zum monitoren, ob was rein kommt
3. C
ssh -p 22 -N -R 8080:localhost:8000 root@129.159.10.245→damit kann getestet werden, ob eine Verbindung möglich ist →ggfs. -i pfadzumprivkey
4. C
autossh -M 0 -f -o ConnectTimeout=10 -o ServerAliveInterval=60 -o ServerAliveCountMax=2 -p 22 -N -R 8080:localhost:8000 root@129.159.10.245→ggfs. mit ps aux | grep ssh die PID suchen und mit kill PID wieder killen
crontab -e
@reboot autossh -M 0 -f -o ConnectTimeout=10 -o ServerAliveInterval=60 -o ServerAliveCountMax=2 -p 22 -N -R 8080:localhost:8000 root@129.159.10.245