快捷搜索:   服务器  安全  linux 安全  MYSQL  dedecms

Linux 登陆限制用户及IP

一、Linux限制IP登陆:

1:目录/etc/下hosts.allow为允许登陆的IP配置文件,如果现在可登陆的IP限制在192.168.0.0网段

可设置为:

sshd:192.168.0.0/255.255.255.0(子网可有可无,无没试过)

2:目录/etc/下hosts.deny为限制IP配置文件,设置为全部不可登陆


sshd:all

这两个配置文件最终配置为,只有在192.168.0.0 网段的IP才可以SSH登陆系统!

二、限制用户登陆:

1、修改 /etc/pam.d/sshd

auth required pam_listfile.so item=user sense=allow file=/etc/sshusers onerr=fail

2、增加用户

echo "root" >> /etc/sshusers

顶(0)
踩(0)

您可能还会对下面的文章感兴趣:

最新评论