In ssh session i pressed ~C then i defined forwarding rule, then got Forwarding port. response, then added another one. how can i view these rules at once? (not by scrolling terminal up)

ssh> ? 
      -L[bind_address:]port:host:hostport    Request local forward
      -R[bind_address:]port:host:hostport    Request remote forward
      -D[bind_address:]port                  Request dynamic forward
      -KL[bind_address:]port                 Cancel local forward
      -KR[bind_address:]port                 Cancel remote forward
      -KD[bind_address:]port                 Cancel dynamic forward

wanted command -... display current port forwarding rules

  • netstat/ss are your friends. – Rui F Ribeiro Jun 27 '18 at 10:50
  • I have netstat on local machine, not on shared remote computer – Yurij Jun 27 '18 at 10:55
  • 2
    I am unfamiliar with the prompt you indicate in your terminal example. What software package/ssh client are you using? – 0xSheepdog Jun 27 '18 at 16:46

The following will list the tunnels created by ssh and sshd:

lsof -i -n | egrep 'ssh'

lsof -i -n | egrep 'sshd'

The following will list all zones and port rules:

firewall-cmd --list-all-zones

  • Nice! lsof do the trick! IPv6 107472 0t0 TCP [::1]:8888 (LISTEN) – Yurij Jun 28 '18 at 8:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.