17 Nov
2018
17 Nov
'18
20:59
On 16.11.18 23:22, Carlos E. R. wrote:
Hi,
on my laptop I use a script that launches several lines like this to connect to my home server:
exec ssh -L 127.0.0.1:60000:192.168.X.Y:80 -N user@host &
It works fine. The problem is killing that connection. What I do is "killall ssh", but perhaps there is another way I have not thought about? I mean, kill that ssh session and not another?
Add the line echo $! to your script directy after that line. This is the PID of ssh you can kill later.