歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux管理 >> Linux服務 >> 修改/etc/hosts.allow和/etc/hosts.deny允許linux服務器允許和限制訪問

修改/etc/hosts.allow和/etc/hosts.deny允許linux服務器允許和限制訪問

日期:2017/3/1 14:05:05   编辑:Linux服務
修改/etc/hosts.allow和/etc/hosts.deny允許linux服務器允許和限制訪問 對於能過xinetd程序啟動的網絡服務,比如ftp telnet,我們就可以修改/etc/hosts.allow和/etc/hosts.deny的配置,來許可或者拒絕哪些IP、主機、用戶可以訪問。 比如我們在 /etc/hosts.allow中加入 all:218.24.129. 這樣就會允許來自218.24.129.*域的所有的客戶來訪問。這只是舉個例子,實際上,系統默認狀態 下,都是能用這些網絡服的 如果我們在 /etc/hosts.deny中加入,就限制了來自218.24.129.*域的所有的所有的IP。 all:218.24.129. 如果我們在 /etc/hosts.deny中加入 all:218.24.129.134,這樣就限制了所有在218.24.129.134中的所有的用戶的訪問。 當hosts.allow和 host.deny相沖突時,以hosts.allow設置優化。 設置好後,要重新啟動 # /etc/rc.d/init.d/xinetd restart # /etc/rc.d/init.d/network restart 不是任何服務程序都能使用TCP_wrappers的,例如使用命令ldd /usr/sbin/sshd,如果輸出中有libwrap,則說明可以使用TCP_wrappers, 即該服務可以使用/etc/hosts.allow和/etc/hosts.deny,如果輸出沒有libwrap則不可使用
Copyright © Linux教程網 All Rights Reserved