![]() ![]() -T disables pseudo-tty allocation, which is appropriate because you're not trying to create an interactive shell.If all you're creating is a tunnel, then including this option saves resources. -N says that you want an SSH connection, but you don't actually want to run any remote commands.-f tells ssh to background itself after it authenticates, so you don't have to sit around running something on the remote server for the tunnel to remain alive.Ssh -R sourcePort:forwardToHost:onPort connectToHost means: connect with ssh to connectToHost, and forward all connection attempts to the remote sourcePort to port onPort on the machine called forwardToHost, which can be reached from your local machine. Remote: -R Specifies that the given port on the remote (server) host is to be forwarded to the given host and port on the local side. Ssh -L sourcePort:forwardToHost:onPort connectToHost means: connect with ssh to connectToHost, and forward all connection attempts to the local sourcePort to port onPort on the machine called forwardToHost, which can be reached from the connectToHost machine. ![]() Local: -L Specifies that the given port on the local (client) host is to be forwarded to the given host and port on the remote side. The machine, where the ssh tunnel command is typed is called »your host«. ![]() So this will be an "ssh connection within another ssh connection".Ĭonsider that if the first ssh-connection will timeout and/or fall down for whatever reason (including: killed by local firewall, due to inactivity), you'll be unable to remote-forward/remotely_connect Īs it's important to leave the first ssh connection active for really long time, you might find useful to launch such ssh within a " screen" sessionĪ final note: Obviously, all of the above has some (potentially serious) security implications that are out of scope of this answer. is binded to the previous ssh connection. SERVER_B:~ $ ssh -p 2222 ssh-connection, launched on SERVER_B, will be directed to the 2222 port listening on localhost that. LINUX_BOX_A:~ $ ssh -R 2222:localhost:22 will open an ssh connection from LINUX_BOX_A to SERVER_B that will be used for the remote, incoming, connection.Īfter above ssh connection is established, you can: The only condition is: LINUX_BOX_A MUST be able to connect via SSH to SERVER_B. SSH remote forwarding can be used to reach LINUX_BOX_A from SERVER_B.
0 Comments
Leave a Reply. |