Answered by the Webhosting Experts

Can I Limit the IP(s) that sshd Listens On?

To limit the IP addresses which sshd listens on, you just need to modify its settings within the sshd_config file. Follow these 4 easy steps:

  1. First, backup the sshd_config file, then edit it with your favorite editor.
  2. Now, to limit the IPs sshd listens on, you need to change the ListenAddress configuration line:

    root@root [~]# cd /etc/ssh/
    root@root [/etc/ssh]# cp sshd_config sshd_config.save
    root@root [/etc/ssh]# vi sshd_config
    root@root [/etc/ssh]# diff sshd_config sshd_config.save
    15c15
    < ListenAddress 10.0.0.1

    > #ListenAddress 0.0.0.0

  3. Next, restart sshd and verify that it’s listening on the specified address:

    root@root [/etc/ssh]# /etc/init.d/sshd restart
    Stopping sshd: [ OK ]
    Starting sshd: [ OK ]
    root@root [/etc/ssh]# netstat -anp | grep sshd
    tcp 0 0 10.0.0.1:22 0.0.0.0:* LISTEN 1718/sshd

  4. If you want sshd to listen on more than one address, then add additional ListenAddress lines to the configuration file:

    root@root [/etc/ssh]# diff sshd_config sshd_config.save
    15,16c15
    < ListenAddress 10.0.0.1
    < ListenAddress 10.0.0.2

    > #ListenAddress 0.0.0.0

    root@root [/etc/ssh]# /etc/init.d/sshd restart
    Stopping sshd: [ OK ]
    Starting sshd: [ OK ]
    root@root [/etc/ssh]# netstat -anp | grep sshd
    tcp 0 0 10.0.0.1:22 0.0.0.0:* LISTEN 1884/sshd
    tcp 0 0 10.0.0.2:22 0.0.0.0:* LISTEN 1884/sshd

And there you have it!

 

Popular Links

Looking for more information on SSH? Search our Knowledge Base!

Interested in more articles about Web Hosting? Navigate to our Categories page using the bar on the left or check out these popular articles:

Popular tags within this category include: DNS, FTP, IIS, MX Records, and more.

Don’t see what you’re looking for? Use the search bar at the top to search our entire Knowledge Base.

 

The Hivelocity Difference

Seeking a better Dedicated Server solution? In the market for Private Cloud or Colocation services? Check out Hivelocity’s extensive list of products for great deals and offers.

With best-in-class customer service, affordable pricing, a wide-range of fully-customizable options, and a network like no other, Hivelocity is the hosting solution you’ve been waiting for.

Unsure which of our services is best for your particular needs? Call or live chat with one of our sales agents today and see the difference Hivelocity can make for you.

Need More Personalized Help?

If you have any further issues, questions, or would like some assistance checking on this or anything else, please reach out to us from your my.hivelocity.net account and provide your server credentials within the encrypted field for the best possible security and support.

If you are unable to reach your my.hivelocity.net account or if you are on the go, please reach out from your valid my.hivelocity.net account email to us here at: support@hivelocity.net. We are also available to you through our phone and live chat system 24/7/365.