Join the community today
Register Now

CSF Allow Defined ip's only for SSH Access

Discussion in 'Other Centmin Mod Installed software' started by negative, Jan 31, 2017.

  1. negative

    negative Member

    216
    21
    18
    Apr 11, 2015
    Ratings:
    +49
    Local Time:
    5:14 PM
    1.9.10
    10.1.11
    Hello

    I want to set SSH access only my defined ip's to my server. Others should be blocked. How can i do it easily. I have defined cloudflare ip's on csf.allow file already so i don't want any mistake and i ask you what is best way to configure it

    p.s: my ssh port is not standart port (22)

    Thanks
     
  2. eva2000

    eva2000 Administrator Staff Member

    30,164
    6,784
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,135
    Local Time:
    12:14 AM
    Nginx 1.13.x
    MariaDB 5.5
    • Agree Agree x 1
  3. negative

    negative Member

    216
    21
    18
    Apr 11, 2015
    Ratings:
    +49
    Local Time:
    5:14 PM
    1.9.10
    10.1.11
    I aggree yes but i bought static ip from my ISP, so it is securely.

    I don't want to go with method-1 because of i worry about csf-iptables problems.

    Method2 is fine, but i don't understand on examples. That website says, use deny list for prevent some ip's. But i want denny all ip's except my ip. So, hosts.allow must be contain my ip then hosts.deny file must be contain that deny all ips ?

    Like that? Thanks
    # /etc/hosts.allow
    sshd: 1.2.3.0

    # /etc/hosts.deny
    sshd: ALL
     
  4. eva2000

    eva2000 Administrator Staff Member

    30,164
    6,784
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,135
    Local Time:
    12:14 AM
    Nginx 1.13.x
    MariaDB 5.5