How do I kill a backgrounded/detached ssh session?

前端 未结 11 1249
刺人心
刺人心 2020-12-01 00:02

I am using the program synergy together with an ssh tunnel

It works, i just have to open an console an type these two commands:

ssh -f -N -L localhos         


        
11条回答
  •  無奈伤痛
    2020-12-01 00:31

    Another option is to use pgrep to find the PID of the newest ssh process

    ssh -fNTL 8073:localhost:873 otherUser@OtherHost
    tunnelPID=$(pgrep -n -x ssh)
    synergyc localhost
    kill -HUP $tunnelPID
    

提交回复
热议问题