我创建了一个从主机A到主机B的ssh隧道。主机A问题:
hosta $ ssh -N -R 2222:localhost:1111 user@hostb
然后,主机B可以连接到其localhost:2222并到达主机A:1111。这行得通。
我想杀死主机B上的特定隧道,所以我需要找到该pid。知道如何找到它吗?
# with this command I can't recognize the specific tunnel
hostb $ ps -ef | grep sshd
# this must run as root which is not acceptable
hostb $ sudo lsof -i -n | egrep '\<sshd\>'