配置ssh遠程訪問策略
阿新 • • 發佈:2017-05-09
.net cin 不能 onf host conf 規則 inux 一個
假如有兩個域,一個是example.com(172.25.0.0/16),一個是my133t.org(172.24.0.0/16)
要求:從域group3.example.com能ssh遠程訪問兩個虛擬機,而在域my133t.org中客戶端不能遠程訪問兩個虛擬機
第一步:
首先要在兩臺虛擬機開啟enforcing模式,打開vi /etc/selinux/config
SELINUX=enforcing
SELINUX=targeted
第二步:
在虛擬機的/etc/hosts.allow和/etc/hosts.deny配置
hosts.allow裏寫入:sshd:172.25.0
hosts.deny裏寫入:sshd:172.24.0
關於:/etc/hosts.allow /etc/hosts/deny文件
這是兩個控制遠程訪問的配置文件,可以控制ip段允許或者拒絕訪問某個服務,通常是ssh服務;當hosts.allow和 host.deny相沖突時,以hosts.allow設置為準。linux 系統會先檢查/etc/hosts.deny規則,再檢查/etc/hosts.allow規則,如果有沖突 按/etc/hosts.allow規則處理
配置ssh遠程訪問策略