Running SSHD on 2 ports?

Posted on 2006-04-19
Medium Priority
Last Modified: 2010-03-18

I need to run SSHD on 2 ports on my Gentoo Linux server.

From the top of the config I grabbed this which should tell you what version I'm using.
'OpenBSD: sshd_config,v 1.69 2004/05/23 23:59:53 dtucker Exp'

Why do I need it on 2 ports? So for internal access I can still connect to 22, and from externally (since my router does not allow routing from one port to a different port, I would like to use a different port number so it's less likely to be hacked.


Question by:H4Inf
LVL 14

Accepted Solution

pablouruguay earned 2000 total points
ID: 16486797
iptables can do that
for example
iptables -t nat -A PREROUTING  -p tcp -d 0/0 --dport 2222 -j DNAT  --to

all connection make to port 2222 go to port 22 for example

Author Comment

ID: 16486817
Fantastic! That was easy.

I also discovered in my searches that you can enter 2 Port lines into the sshd_config file - and it will run on both.

Either way does the trick! Cheers

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question