LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 09-28-2005, 10:34 PM   #1
lmcilwain
Member
 
Registered: Dec 2003
Location: Maryland
Distribution: Fedora 14
Posts: 367

Rep: Reputation: 30
ssh port forwarding question


Is there a way that I can port forward an ssh connection to another machine on my network?

I would like to ssh into my machine at home that has 22 open on my router and then be able to open another terminal and ssh to any other machine on my local network at home through my already open ssh connection.

I created an ssh script that had something to this affect:

-L 6000:IP ADDRESS OF MACHINE ON HOME NETWORK:22

If that is supposed to work then maybe I am not typing my ssh command properly. If that is so can anyone tell me how to ssh to a specific port?

Thanks for the help.
 
Old 09-28-2005, 10:51 PM   #2
slackhack
Senior Member
 
Registered: Jun 2004
Distribution: Arch, Debian, Slack
Posts: 1,016

Rep: Reputation: 46
port 22 is the default, so you don't have to specify it. if you change the sshd port number, you specify it with -p, for example:

$ ssh -l user IP -p 1234
 
Old 09-29-2005, 08:52 AM   #3
lmcilwain
Member
 
Registered: Dec 2003
Location: Maryland
Distribution: Fedora 14
Posts: 367

Original Poster
Rep: Reputation: 30
So if Im specifying that ssh command is that something I do once I am authenticated to my home network from another terminal or is that something I change in my ssh script?
 
Old 09-29-2005, 03:29 PM   #4
ckeswani
LQ Newbie
 
Registered: Sep 2005
Posts: 10

Rep: Reputation: 0
Quote:
I would like to ssh into my machine at home that has 22 open on my router and then be able to open another terminal and ssh to any other machine on my local network at home through my already open ssh connection.

I created an ssh script that had something to this affect:

-L 6000:IP ADDRESS OF MACHINE ON HOME NETWORK:22

If that is supposed to work then maybe I am not typing my ssh command properly. If that is so can anyone tell me how to ssh to a specific port?
From the command line, you can type in
Code:
ssh -L 6000:IP ADDRESS OF MACHINE ON HOME NETWORK:22 username@home_external_ip
Then, from another terminal, you can do
Code:
ssh -p 6000 username@localhost
and your connection will automatically be forwarded to port 22 on IP ADDRESS OF MACHINE ON HOME NETWORK.

If you see an error about a host key having changed, let me know and we'll work through that.
 
Old 09-29-2005, 03:32 PM   #5
lmcilwain
Member
 
Registered: Dec 2003
Location: Maryland
Distribution: Fedora 14
Posts: 367

Original Poster
Rep: Reputation: 30
I didn't see the error about the host key changing and everything worked well. Thank you for all of your help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SSH Port forwarding WRSpithead Linux - Networking 1 04-18-2005 05:09 AM
ssh port forwarding (tunneling?) question podollb Linux - Software 4 10-20-2004 02:12 AM
A little question to an SSH guru (port forwarding) J_Szucs Linux - Software 3 11-01-2003 08:59 AM
Ssh port forwarding? J_Szucs Linux - Networking 1 10-29-2003 05:42 AM
ssh, and port forwarding Tricky Linux - Networking 3 01-06-2003 08:50 PM


All times are GMT -5. The time now is 12:33 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration