AlpineWeb Design Home
Is there a domain name available for you?
Search: For:   ~ Advanced Search
    Hosting > Virtual Private Servers > Administration > Security >

Limiting SSH Access to Specific IP Addresses

Log into each server via SSH and su to root.
  1. Edit /etc/hosts.allow
  2. Open a new line before:

    # Start by allowing everything (this prevents the rest of the file.
    # from working, so remove it when you need protection).
    # The rules here work on a "First match wins" basis.
    ALL : ALL : allow

    and add the following:

    sshd: ALL : deny
  3. For each IP address you want to allow, add the following to /etc/hosts.allow above the line sshd : ALL : deny:

    sshd : xxx.xxx.xxx.xxx : allow
    sshd : xxx.xxx.xxx.xxx : allow
    sshd: ALL : deny
  4. Save the file
IMPORTANT: Before you log off your current SSH session, try to open another SSH session to the machine you just made these settings on.  If you cannot get into the system, then in your already open SSH session, then comment out the lines you added.


image


image
Authorized viaVerio Reseller         Authorize.net         Miva Certified Business Partner