hosts.allow和hosts.deny
/etc/hosts.allow和/etc/hosts.deny两个文件是控制远程访问设置的,通过他可以允许或者拒绝某个ip或者ip段的客户访问linux的某项服务。
比如SSH服务,我们通常只对管理员开放,那我们就可以禁用不必要的IP,而只开放管理员可能使用到的IP段。
使用:
修改/etc/hosts.allow文件
#
# hosts.allow This file describes the names of the hosts which are
# allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
sshd:210.13.218.*:allow
sshd:222.77.15.*:allow
以上写法表示允许210和222两个ip段连接sshd服务(这必然需要hosts.deny这个文件配合使用),当然:allow完全可以省略的。
当然如果管理员集中在一个IP那么这样写是比较省事的
all:218.24.129.110//他表示接受110这个ip的所有请求!
/etc/hosts.deny文件,此文件是拒绝服务列表,文件内容如下:
#
# hosts.deny This file describes the names of the hosts which are
# *not* allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow. In particular
# you should know that NFS uses portmap!
sshd:all:deny
注意看:sshd:all:deny表示拒绝了所有sshd远程连接。:deny可以省略。
所以:当hosts.allow和 host.deny相冲突时,以hosts.allow设置为准。
注意修改完后:
service xinetd restart
才能让刚才的更改生效。
总结:通过这种方法可以控制部分非授权访问,但不是一劳永逸的方法!我们在看服务日志的时候或许会看到很多扫描记录,不是还是直接针对root用户的,这时控制你的访问列表就非常有作用了!
hosts.allow和hosts.deny的更多相关文章
- hosts.allow和hosts.deny支持哪些服务
一.背景简介 在linux上多用iptables来限制ssh和telnet,编缉hosts.allow和hosts.deny感觉比较麻烦比较少用. aix没有iptables且和linux有诸多不同, ...
- centos 阶段复习 2015-4-6 dd命令 hosts.allow和hosts.deny 啊铭的myssh脚本 清空history命令历史 /dev/zero 零发生器 /dev/null 黑洞 /dev/random 生成随机数 第十一节课
centos 阶段复习 2015-4-6 dd命令 hosts.allow和hosts.deny 啊铭的myssh脚本 清空history命令历史 /dev/zero 零发生器 /dev/nul ...
- 使用hosts.allow和hosts.deny实现简单的防火墙
说明:我建议学习防火墙只单一学习一种就够了,这种方式虽然简单和快速,但也有些不太灵活,所以如果要深入防火墙建议转iptables 一.背景简介 在Linux上多用iptables来限制ssh和tel ...
- hosts.allow、hosts.deny无效查看服务是否支持tcp_Wrappers
通过配置hosts.allow.hosts.deny,控制SSH限制固定IP登陆 按照以往的方法,分别在hosts.allow.hosts.deny加入以下配置 # more /etc/hosts.a ...
- hosts.allow和hosts.deny文件
之前想通过外部主机访问自己主机上的VMWare虚拟机,使用了VMWare的NAT端口映射,经过一番尝试,算是成功了,总结一下. VMWare NAT端口映射就可以将虚拟机上的服务映射成自己主机上的端口 ...
- 通过配置hosts.allow和hosts.deny文件允许或禁止ssh或telnet操作
1.登录主机,如果是普通账户先切换至root账号 su root 2.编缉/etc/hosts.allow文件 vi /etc/hosts.allow 允许内容 书写格式(改成自自需要的IP或IP段) ...
- 最新hosts,更新hosts,可用
点击这里,全选后复制,粘贴到C:\Windows\System32\drivers\etc的hosts里面,把原来的置换了
- Fiddler如何切换hosts以及切换hosts的另一个神器SwithcHosts
- hosts.allow hosts.deny
简单控制访问ip,hosts.allow/hsots.deny a simple access control language that is based on client (host name ...
随机推荐
- HTML5 中的Nav元素详解
什么是Nav元素 Nav元素可以用作页面导航的链接组,在导航链接组里面有很多的链接,点击每个链接可以链接到其他页面或者当前页面的其他部分,并不是所有的链接组都要被放在nav元素里面,我们只需要把最主要 ...
- vCenter Server Appliance
vCenter Server Appliance https://10.0.0.10:5480
- svn 版本控制
首先来下载和搭建SVN服务器. Subversion已经迁移到apache网站上了,下载地址: http://subversion.apache.org/packages.html windows操作 ...
- JQuery实现table分页
1.直接贴代码: ; //每页显示的记录条数 ; //显示第curPage页 var len; //总行数 var page; //总页数 $(function(){ len =$(; //去掉表头 ...
- ubuntu-kylin16.04搭建lamp环境。
首先下载安装apache2 输入:sudo apt-get install apache2 安装完毕后,在浏览器中输入:localhost 显示如下图,说明安装正确. 紧接着安装php7.0 输入:s ...
- 下载历史版本App超详细教程
有些时候我们需要下载旧版本的 App 进行研究或者其他用途,然而在 iOS 下,苹果的 App Store 里面默认只能下载最新版本的 App,对滴,就是这么任性,不服不行.然而在 Android 里 ...
- Custom Web Servic In MOSS 2007
Tools: Visual Studio 2008,Visual Studio 2008 Command Prompt, Sharepoint Server 2007 Generate .disco ...
- iOs基础篇(二十二)—— UIPickerView、UIDatePicker控件的使用
一.UIPickerView UIPickerView是一个选择器控件,可以生成单列的选择器,也可生成多列的选择器,而且开发者完全可以自定义选择项的外观,因此用法非常灵活. 1.常用属性 (1)num ...
- 【基本技能篇】>>第2篇《如何把事情做到最好——心得》
如何把事情做到最好——全美第一本系统阐述学习与成功之道的经典著作. ——2016年2月12日 四个阅读层次:①基础阅读,具有基本阅读的能力,包括认识字,懂得词,知会句子的基本意思等.②检视阅读(也是判 ...
- org.apache.catalina.webresources.Cache.getResource Unable to add the resource
org.apache.catalina.webresources.Cache.getResource Unable to add the resource at xxx to the cache be ...