Dear list, I'm relatively new to using ssh. I'm trying to use the -R option to set up a forwarded port between two machines. Specifically I'd like to be able to ssh to machineB from machineA and then have a port on machineB that I can connect to machineA with. If my understanding is correct I'd need a command like: machineA> ssh -R 10000:machineA:23 machineB This should open port 10000 on machineB to be forwarded to machineA:23, right? Assuming I have telnet open on machineA I should be able to then: machineB> telnet machineB 10000 For some reason this doesn't work. Is what i'm trying to do possible? Any suggestions? Thanks, Ken (below is the debug output when I run the above command with the -v option) [root at machineA /root]# ssh -v -R 10000:machineA:23 machineB SSH Version OpenSSH-2.1, protocol versions 1.5/2.0. Compiled with SSL (0x0090581f). debug: Reading configuration data /etc/ssh/ssh_config debug: Applying options for * debug: Seeding random number generator debug: ssh_connect: getuid 0 geteuid 0 anon 0 debug: Connecting to machineB [192.168.1.20] port 22. debug: Seeding random number generator debug: Allocated local port 824. debug: Connection established. debug: Remote protocol version 1.99, remote software version OpenSSH-2.1 debug: Local version string SSH-1.5-OpenSSH-2.1 debug: Waiting for server public key. debug: Received server public key (768 bits) and host key (1024 bits). debug: Host 'machineB' is known and matches the RSA host key. debug: Seeding random number generator debug: Encryption type: 3des debug: Sent encrypted session key. debug: Installing crc compensation attack detector. debug: Received encrypted confirmation. debug: Trying RSA authentication with key 'root at machineA' debug: Received RSA challenge from server. debug: Sending response to host key RSA challenge. debug: Remote: RSA authentication accepted. debug: RSA authentication accepted by server. debug: Requesting pty. debug: Connections to remote port 10000 forwarded to local address machineA:23 debug: Requesting shell. debug: Entering interactive session. [root at machineB /root]# ........ [root at machineB /root]# telnet machineB 10000 Trying 192.168.1.20... telnet: Unable to connect to remote host: Connection refused
On Mon, Jun 12, 2000 at 11:58:28AM -0400, Kenneth J Baker wrote:> > Dear list, > > I'm relatively new to using ssh. I'm trying to use the -R option to set > up a forwarded port between two machines. Specifically I'd like to be > able to ssh to machineB from machineA and then have a port on machineB > that I can connect to machineA with. If my understanding is correct I'd > need a command like: > machineA> ssh -R 10000:machineA:23 machineBthis is correct. the following line does the same: machineA> ssh -R 10000:localhost:23 machineB> This should open port 10000 on machineB to be forwarded to machineA:23, > right? Assuming I have telnet open on machineA I should be able to then: > machineB> telnet machineB 10000 > > For some reason this doesn't work. Is what i'm trying to do possible? > Any suggestions?does machineB> telnet localhost 10000 work? if you want to make sshd listen to port 10000 on _all_ interfaces (default is loopback only) you have to use the GatewayPorts option for sshd, see sshd(8). -m