Check SSH configuration
sshd -t
Show active SSH connections
lsof -i -n | egrep '\<ssh\>'
Script to keep alive SSH connection with varying IP:
#!/bin/bash if [ -z "$(ps ax | awk '{print $9}' | grep 2200:svarm:2200)" ] then ssh -N -f -R 2200:svarm:2200 -p 2222 mynetwork.net fi
Establish SSH tunnel to DB on background, save its PID and kill it afterwards:
#!/bin/bash ssh -N -L 3333:db.myserver.com:3306 jump-host & pid=$! do something kill -9 $pid
Leave a comment