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 > port forwarding with ssh

port forwarding with ssh
Thread Tools
dice
Forum Regular
Join Date: Jul 2002
Location: Ireland
Status: Offline
Reply With Quote
Feb 11, 2009, 07:33 PM
 
I wish to be able to SSH into my mac remotely but am having some trouble port forwarding...

I have a Netopia router and I can setup port forwarding on it but my housemate has grabbed the mapping to port 22 and the router won't let me add another port mapping to port 22...

So, I need to map to another port, let's say port 9999.

The problem I have is getting my mac's SSH to listen on port 9999. I was hoping to be able to setup some sort of "internal" port mapping to map incoming SSH connections from port 9999 to port 22. This way when my laptop is not behind the router it will still respond to port 22 as normal.

I am using 10.5 and tried the following ipfw command with no luck:
> sudo ipfw add 0 allow tcp from any 9999 to any 22


Any help would be most appreciated!
sheesh, that took 8 hours for me to be asked to change my sig...
     
Steve Bosell
Mac Enthusiast
Join Date: May 2001
Status: Offline
Reply With Quote
Feb 11, 2009, 08:07 PM
 
I would just uncomment the line in /etc/sshd_config and change the port to 2222 , then restart sshd

edit: looks like there is another config in /private/etc/sshd_config , I would try that one first.
     
Tomchu
Mac Elite
Join Date: Sep 2005
Status: Offline
Reply With Quote
Feb 11, 2009, 09:04 PM
 
/etc is just a symlink to /private/etc, so they're the same configuration

If I were you, I would just edit that file, uncomment the "#Port 22" line, and add another line after it with "Port 2222" or whatever other port you want. SSH will then listen on both. You'll need to restart the daemon (easiest way would be to just uncheck it in Sharing and recheck it). Of course, you'll need to add access through to port 2222 in your firewall configuration as well.
     
dice  (op)
Forum Regular
Join Date: Jul 2002
Location: Ireland
Status: Offline
Reply With Quote
Feb 12, 2009, 06:15 AM
 
Thanks for the replies. I tried editing the file but I still get connection refused even after a restart. I tried sshing to localhost on my custom port with the same result as well.

I came across this blog post:
http://tektastic.com/2007/08/mac-os-...n-sshd-on.html

I'll try it later today after work
sheesh, that took 8 hours for me to be asked to change my sig...
     
dice  (op)
Forum Regular
Join Date: Jul 2002
Location: Ireland
Status: Offline
Reply With Quote
Feb 13, 2009, 01:25 PM
 
The above blog post method worked for me
sheesh, that took 8 hours for me to be asked to change my sig...
     
   
 
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 12:35 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.,