Home  >  Q&A  >  body text

iptables - CentOS下如何限制指定用户只能在指定IP登录?

如题。用 hosts 针对的是所有用户。
貌似可以用配置 /etc/ssh/sshd_config 方式去限制。
貌似也可以配置 iptables 去限制。
但不知哪种方法更好?该如何配置。能否详细讲解?谢谢!

phpcn_u1582phpcn_u15822708 days ago687

reply all(1)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-24 16:01:43

    In view of LZ’s requirements, it is recommended to use sshd_config, iptables is not suitable.
    Configuration: AllowUsers wangshuo@172.31.11.237
    Note that after modification, restart the service: service sshd restart

    reply
    0
  • Cancelreply