Home > ssh > How to remove SSH port forwarding

How to remove SSH port forwarding

July 3Hits:2

The following command has been executed on our server, Nexus, to forward remote desktop connections to remote machine Lagos-B:

screen -S rdp ssh -L [*]:886: [email protected] -N 

I need to change this bind but I cannot simply overwrite it by entering new command - so how do I remove this existing SSH port forwarder.

Background if needed:

In original setup Nexus would SSH directly into Lagos-B. Lagos-B (a CentOS system) has socat configured to send incoming TCP traffic on port 886 to another machine.

We have changed this and we now have a VPN connection between Nexus and Lagos-B. If I enter the IP address on Nexus into my laptop and unplug the Nexus I can RDP into the remote system without issues. If I try to RDP to Nexus' IP address with the custom port the connection fails.


If you have access to the existing SSH session, you can use OpenSSH's "escape character" to modify your session on-the-fly. When you type "~" plus a character, it escapes the current SSH session, and allows you to execute a command. From the manpage:

     ~#  List forwarded connections.

     ~C  Open command line.  Currently this allows the addition of port
         forwardings using the -L, -R and -D options (see above).  It also
         allows the cancellation of existing remote port-forwardings using
         -KR[bind_address:]port.  !command allows the user to execute a
         local command if the PermitLocalCommand option is enabled in
         ssh_config(5).  Basic help is available, using the -h option.

You can add, change, remove any command line port forwarding magic you've added previously. Look at the manpage for further documentation.

Tags:ssh, vpn, centos

Related Articles

  • How to remove SSH port forwardingJuly 3

    The following command has been executed on our server, Nexus, to forward remote desktop connections to remote machine Lagos-B: screen -S rdp ssh -L [*]:886: [email protected] -N I need to change this bind but I cannot simply overwrite it by

  • Can I use SSH port forwarding to connect via RDC to a Windows VM setup to use NAT?August 8

    I have the following, totally bizarre, please don't ask, setup: AirPort router iBook running Virtual PC connected to AirPort MacBook running RDC connected to AirPort A Windows XP VM running on Virtual PC with NAT network settings. I want to access th

  • ssh port forwarding problemFebruary 18

    I want to use ssh port forwarding. I haven't used this feature for a few years, so I may have forgotten something obvious, or OS defaults may have changed. I have tried this on three different machines (all Ubuntu 9.10). The debug says that it is ope

  • How do I log SSH port forwards?September 16

    Say I have an SSH server, with port forwarding enabled. It's fairly simple for a user to set up an SSH connection and forward BitTorrent traffic or other illegal or abusive traffic over it. How can I set up logging to record what port forwards users

  • Setting up iptables or ssh port forwarding for connecting to mysqlApril 6

    I've got a linux (ubuntu) computer at work from where I can connect to an external mysql server (not on company NAT). I've also got a laptop from which I want to connect to the mysql server but outside the work network. How can I setup iptables or ss

  • ssh port forwarding is not available (locally) for IP rather localhost onlyMay 15

    I have a remote machine at example.com with sshd listening to port 1234 and a web service at port 5678. For some reasons, I want to 'localize' the http requests to that web service. When I execute ssh -L 4321:example.com:5678 [email protected] -p 1234

  • SSH Port Forward a local IRC server to my remote serverJuly 13

    So, I have this slight dilemma: I am not allowed to host an IRC server on my VPS, but I am allowed to use tunneling of some sort to let users connect to an IRC server I have set up locally on my Mac Mini. Basically - how would I go about tunneling co

  • SSH port forwarding, forward port over VPNApril 17

    The scenario: I have a Linux laptop (linuxlaptop) There's a piece of software that I develop that access a web service https://ws.behind-vpn.com that is behind a Cisco AnyConnect VPN. I cannot connect to the VPN from the Linux laptop (the VPN certifi

  • Is it possible to use SSH port forwarding with FTP?April 18

    I tried using SSH port forwarding with FTP but it didn't work even though I used FTP connections. It seems that the FTP server gives you another port number to use, so you must be able to connect to that port in order to receive data from the server.

  • SSH port forwarding with automatic reconnect, script executing at startupDecember 27

    In short, every time my computer boots, I would like to start a ssh port-forwarding connection that will reconnect with the server if the connection drops. Computer is Debian Wheezy x64. An initial and successful connection can be made as follows: sc

  • SSH port forwarding to a host that needs to contact a third named host to access MySQLFebruary 7

    We customize and support standard web applications that our customers host on managed servers from different web hosters. Usually, the application consists of a web application in PHP and a database (mostly MySQL). For our customers, we want to offer

  • What's ssh port forwarding and what's the difference between ssh local and remote port forwarding

    What's ssh port forwarding and what's the difference between ssh local and remote port forwarding February 19

    This question already has an answer here: ssh port forward to access my home machine from anywhere 3 answers How does reverse SSH tunneling work? 3 answers I feel confused about ssh port forwarding and the difference between ssh local and remote port

  • SSH port forwarding (SQLYog Tunnel)March 29

    I'm running CentOS 4.3 and ISPConfig 2.2 with OpenSSH 0.9.7a. I'm able to login via putty on windows to my linux box and login to mysql. I would like to use SQLyog Enterprise to create a SSH tunnel to mysql, however, when I attempt to do this, I get

  • Accessing mysql behind firewall with ssh port forwardingOctober 8

    I have an architecture which looks like this: | - DMZ - | ________ | ________ | _______ | CLIENT | | | SERVER | | | MYSQL | |________| | |________| | |_______| | | | <-FIREWALLS-> | I need to connect from CLIENT (linux) to MYSQL (service running on

  • SSH Port Forwarding October 24

    This question already has an answer here: SSH connection refused from inside my LAN 2 answers I'm trying to set up an ssh port forwarding from my router to my linux host. I'm using the dynamic dns service from http://www.dnsexit.com. I'm using their

  • OpenVPN over SSh port forwarding : can't redirect all trafic through VPNNovember 5

    I'm trying to escape my university wifi network rules with my Macbook (OSX 10.10). The university allows us to use a server, say bastion.univ.com, to mount an ssh port forwarding. I've an OpenVPN server running at home (tunnelblick). On client : I mo

  • iMessage / iCloud via SSH Port forward to get through firewallJanuary 23

    What ports does iCloud and iMessage use and is it possible to use SSH port forwarding via a proxy to use them on a network that blocks the services? --------------Solutions------------- According to: http://support.apple.com/en-us/HT202078 | Ports |F

  • Persistent SSH port forward without public keysMarch 13

    Problem I haven't found a solution to run an SSH port forward in a reliable and persistent fashion, when the server you are connecting to does not support public-key authentication. Question What is the most reasonable way to keep a persistent SSH po

  • What does port forwarding mean in "SSH port forwarding"?

    What does port forwarding mean in "SSH port forwarding"?October 22

    Wikipedia says In computer networking, port forwarding or port mapping is an application of network address translation (NAT) that redirects a communication request from one address and port number combination to another while the packets are travers

  • Linux iptables ssh port forwarding (martian rejection)November 23

    I have a Linux gateway performing NAT for my home network. I have another network which I'd like to transparently forward packets to, but only to/from specific IP/ports (ie. not a VPN). Here's some example IP and ports to work with: Source Router Rem

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.512 s.