Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > SSH: Listen on 2 ports

SSH: Listen on 2 ports
Thread Tools
ajbaker
Registered User
Join Date: Mar 2001
Location: Farnborough, UK
Status: Offline
Reply With Quote
Jan 3, 2006, 12:41 PM
 
Not sure if this is the most appropriate place, but...

My Mac is behind a router, and I use SSH to access it from work. The Mac can be connected to the router by either ethernet cable or wirelessly. I have the router forward WAN port 22 to the Macs wireless IP address.

However when the Mac is connected via ethernet cable (and I turn Airport off) this no longer works as the Mac acquires a different IP address (I have reserved IP addresses for an unrelated reason). Currently I use the routers public web admin interface to change the port forwarding to the other IP address.

In order to avoid this manual step, is there any way to setup the SSH server to listen on more than one port?

I have already tried to forward port 24 to 22 on my Mac. While this work if ssh'ing from the Mac itself, it does not work from work. (However because it doesnt show in the routers logs im guessing that is because I cannot access this port from work.)

Ideas?
     
pat++
Mac Elite
Join Date: May 2001
Location: Earth
Status: Offline
Reply With Quote
Jan 3, 2006, 12:50 PM
 
Set up your wired/wireless networks to use the same IP/subnet mask. Then use the same IP (make sure you turn off airport when you are connected with ethernet).

It looks like your problem is not the port, but the IP address which is changing.
     
ajbaker  (op)
Registered User
Join Date: Mar 2001
Location: Farnborough, UK
Status: Offline
Reply With Quote
Jan 3, 2006, 01:09 PM
 
Sorry I should have been a little more clear, the router cannot forward from one external port to another internal port. It will only forward the same port number.

Therefore when I say I have forwarded 24 to 22 on the Mac, I mean I have used:
ssh localhost -L 24:localhost:22

When I try 'ssh -p 24 localhost' I can connect. However when I try 'ssh -p 24 domain.name' it fails and does not leave a trace in router log.

Setting the Mac to use the same wired/wireless IP would work but is not really my desired solution. Thanks for tip none the less though.
     
Tomchu
Mac Elite
Join Date: Sep 2005
Status: Offline
Reply With Quote
Jan 3, 2006, 01:57 PM
 
sudo vim /etc/sshd_config

Then find the Port option, uncomment it, and add a few more. You can do:
...
Port 22
Port 23
Port 24
...

You'll have to restart sshd for the changes to take effect after you save the file.
     
Jellytussle
Dedicated MacNNer
Join Date: Jan 2001
Location: Badfort
Status: Offline
Reply With Quote
Jan 4, 2006, 10:51 AM
 
If you're on 10.4 ,you'll need to make launchd aware of what you want. Have a look at http://www.macosxhints.com/article.p...50707140439980 for more discussion.
You see, my friends, pirates are the key. - thalo
     
   
 
Forum Links
Forum 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 On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 08:20 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,