centos7.5只允许白名单用户ssh远程连接

1.编辑/etc/hosts.allow文件

# vim /etc/hosts.allow

添加指定IP货值IP段

# 允许192.168.1.10 IPssh连接

sshd : 192.168.1.10 : allow

# 允许192.168.2. IP段ssh连接
sshd : 192.168.2.* : allow

all:192.168.1.12//他表示接受12这个ip的所有请求!(不推荐)

2.编辑/etc/hosts.deny文件

# vim /etc/hosts.deny

最后添加  sshd:all:deny 

# sshd:all:deny(拒绝所有请求,当hosts.allow和 host.deny相冲突时,以hosts.allow设置为准)

3.重启sshd服务

# /bin/systemctl restart sshd.service

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章