Running SSHD on 2 ports?

Posted on 2006-04-19
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

    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

    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    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…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now