zoukankan      html  css  js  c++  java
  • centos7设置SSH安全策略–指定IP登陆

    设定出某个ip其他ip不可以访问

    a) 设置禁止所有ip连接服务器的SSH

    vim /etc/hosts.deny
    sshd:all:deny

    b) 设置允许指定ip连接服务器的SSH(这边建议设置一个备用允许连接的ip)

    vim /etc/hosts.allow
    sshd:192.168.1.106:allow

    重启SSH服务,并通过登录进行验证

    systemctl restart sshd.service
    systemctl status sshd.service

     From https://www.cnblogs.com/marso/archive/2018/01/06/8214927.html

    一、防火墙的开启、关闭、禁用命令

    (1)设置开机启用防火墙:systemctl enable firewalld.service

    (2)设置开机禁用防火墙:systemctl disable firewalld.service

    (3)启动防火墙:systemctl start firewalld

    (4)关闭防火墙:systemctl stop firewalld

    (5)检查防火墙状态:systemctl status firewalld

    二、使用firewall-cmd配置端口

    (1)查看防火墙状态:firewall-cmd --state

    (2)重新加载配置:firewall-cmd --reload

    (3)查看开放的端口:firewall-cmd --list-ports

    (4)开启防火墙端口:firewall-cmd --zone=public --add-port=9200/tcp --permanent

      命令含义:

      –zone #作用域

      –add-port=9200/tcp #添加端口,格式为:端口/通讯协议

      –permanent #永久生效,没有此参数重启后失效

      注意:添加端口后,必须用命令firewall-cmd --reload重新加载一遍才会生效

    (5)关闭防火墙端口:firewall-cmd --zone=public --remove-port=9200/tcp --permanent

  • 相关阅读:
    POJ 3009
    POJ 3253
    POJ 3617
    POJ 3984
    UVA10012
    HDU5100
    HDU 5101
    UVA301 运输
    UVA 331 交换的方案数
    uva 10344 算23点
  • 原文地址:https://www.cnblogs.com/jhtchina/p/14977287.html
Copyright © 2011-2022 走看看