How do I find the process that is listening on port 'xxxx' and kill it?
I have RemoteForward 2022 remote.host:22
in my .ssh/config file.
Whenever I ssh into a remote server: ssh staging-environment
I am getting this error: Warning: remote port forwarding failed for listen port 2022
I need this port open for port forwarding.
How do I find the process that is listening on port 2022 and kill it?
UPDATE:
Output of netstat -tulpn
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:81 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:83 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:84 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:85 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:86 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:2022 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:2023 0.0.0.0:* LISTEN -