限制用户从特定ip登录的两个技巧由于ssh是管理员最常使用和最便简的工具,因此ssh管理是最为重要的.技巧 1 修改ssh端口/etc/ssh/sshd_config#Port 22You chang
.
限制用户从特定ip登录的两个技巧
..由于ssh是管理员最常使用和最便简的工具,因此ssh管理是最为重要的.技巧 1 修改ssh端口
/etc/ssh/sshd_config..#Port 22..You change the above line to (if say I want to change port to 5022):..Port 5022..[Expert@fireball]# service sshd restart..Now you connect to the firewall #ssh -p 5022 user@IP
技巧2 限制ssh用户从特定ip登录
Openssh provides the possibility to restrict access for specific user to specific IP addresses. I will look here at few potential scenarios.
Case 1 限制用户从特定ip登录 ,这里是网络 99.19.19.0/24:
在 /etc/ssh/sshd_config 最底下增加:..AllowUsers *@99.19.19.*..重启生效,只有来自99.19.19.0/24 的用户才可以登录
Case 2限制一些用户从特定ip登录但其它可以从任务地址登录...如admin可以从 LAN 10.88.88.0/24 and WAN IP is 123.123.123.10登录,yurisk可以从任务地点登录.../etc/ssh/sshd_config
AllowUsers [email protected] [email protected].* yurisk...