Categories

Our Sponsors

SSH Tunneling How-To

First there are a couple scenarios for the tunnel.

Out_host -> Gateway -> Other_host

In this sense you want to get to the other host or to a port on another host.

Use: ssh -L local_listen_port:gateway:gateway_port Other_host

Remote forwarding is used to skip past systems to a destination. You can then use the ssh -p port $user@localhost to ssh back to the original system.

ssh -R destination_port:localhost:local_port destination_host

ssh -R remote_port:localhost:22 your_dest_computer

ex. $ ssh -R 2048:localhost:22 other.computer.com

Real Life: ssh from adm3 to www2, then ssh back from www2.
On adm3: ssh -R 2222:localhost:22 www2 (This logs you into www2)
From www2: ssh -p 2222 localhost (This logs you back into adm3)

Oh now we get tricky.
Set up a local port on www2 so that you could use adm3 as a ssh gateway.
ssh -p 2222 -L 7777:Other_host:22 localhost

(ssh to the local port 2222 on localhost, set a new local port 7777 that will pass through port 22 on Other_host(Alternate dest host) )

Now you could log into Other_host from www2.

ssh -l $user -p 7777 localhost (Connects me to Other_host)

More info:
http://www.linuxtutorialblog.com/post/ssh-and-scp-howto-tips-tricks

You can use a piped scp. This will set the source and destination as $user@$host:/$path The $user, $host and $path can all be differnet.

scp -pr $user1@host1.com:/path/* $user2@host2.net:/dest_path/

Share

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Get Adobe Flash playerPlugin by wpburn.com wordpress themes