linux远程访问权限控制
2010-09-27 11:57
429 查看
/etc/hosts.allow和/etc/hosts.deny两个文件是控制远程访问设置的,通过他可以允许或者拒绝某个ip或者ip段的客户访问linux的某项服务。
比如SSH服务,我们通常只对管理员开放,那我们就可以禁用不必要的IP,而只开放管理员可能使用到的IP段。
使用:
修改/etc/hosts.allow文件
#
#hosts.allowThisfiledescribesthenamesofthehostswhichare
#allowedtousethelocalINETservices,asdecided
#bythe'/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.denyThisfiledescribesthenamesofthehostswhichare
#*not*allowedtousethelocalINETservices,asdecided
#bythe'/usr/sbin/tcpd'server.
#
#Theportmaplineisredundant,butitislefttoremindyouthat
#thenewsecureportmapuseshosts.denyandhosts.allow.Inparticular
#youshouldknowthatNFSusesportmap!
sshd:all:deny
注意看:sshd:all:deny表示拒绝了所有sshd远程连接。:deny可以省略。
所以:当hosts.allow和host.deny相冲突时,以hosts.allow设置为准。
注意修改完后:
service xinetd restart
或者/etc/init.d/xinetd restart
才能让刚才的更改生效。
启动xinetd也可以用,/etc/rc.d/init.d/xinetd start
(有的系统可能没有安装xinetd服务,yum -y install xinetd即可)
比如SSH服务,我们通常只对管理员开放,那我们就可以禁用不必要的IP,而只开放管理员可能使用到的IP段。
使用:
修改/etc/hosts.allow文件
#
#hosts.allowThisfiledescribesthenamesofthehostswhichare
#allowedtousethelocalINETservices,asdecided
#bythe'/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.denyThisfiledescribesthenamesofthehostswhichare
#*not*allowedtousethelocalINETservices,asdecided
#bythe'/usr/sbin/tcpd'server.
#
#Theportmaplineisredundant,butitislefttoremindyouthat
#thenewsecureportmapuseshosts.denyandhosts.allow.Inparticular
#youshouldknowthatNFSusesportmap!
sshd:all:deny
注意看:sshd:all:deny表示拒绝了所有sshd远程连接。:deny可以省略。
所以:当hosts.allow和host.deny相冲突时,以hosts.allow设置为准。
注意修改完后:
service xinetd restart
或者/etc/init.d/xinetd restart
才能让刚才的更改生效。
启动xinetd也可以用,/etc/rc.d/init.d/xinetd start
(有的系统可能没有安装xinetd服务,yum -y install xinetd即可)
相关文章推荐
- linux远程访问权限控制(hosts.allow和hosts.deny)
- linux远程访问权限控制(hosts.allow和hosts.deny)
- 安装mysq 在linux,以及配置权限, 让某个账户能远程访问并且访问所有数据库
- linux下mysql开启远程访问权限及防火墙开放3306端口
- Linux下MySQL开放root的远程访问权限
- 百晓生带你玩转linux系统服务搭建系列----SSH远程访问及控制
- linux下 /etc/hosts.allow和/etc/hosts.deny两个文件是控制远程访问设置的,通过他可以允许或者拒绝
- linux下mysql开启远程访问权限及防火墙开放3306端口
- mysql在Linux环境下开启远程访问权限和开放3306端口
- 如何在Linux下设置访问控制列表(ACL)来控制用户的权限
- linux下mysql开启远程访问权限及防火墙开放3306端口
- Linux 文件特殊权限和访问控制列表
- linux或mac下,通过本机访问远程mysql数据库(数据库本身未开启远程访问权限)
- Linux运维笔记----sshd(远程访问控制服务)
- linux下mysql开启远程访问权限及防火墙开放3306端口
- linux下mysql开启远程访问权限及防火墙开放3306端口
- 在Linux(CentOS 6.2 64位操作系统)下安装MySQL数据并开启远程访问权限
- linux驱动学习之模块访问权限的控制
- linux安装mysql,设置远程访问权限
- linux安装mysql之设置远程访问权限