认识系统服务(daemons)
来源:互联网 发布:idle python gui 编辑:程序博客网 时间:2024/05/18 01:19
认识系统服务(daemons)
---------------
服务主要分为stand_alone和super daemon两种。
stand_alone:常驻在内存中的进程,可以独立被启动,启动方式: `/etc/init.d/... start`
super daemon:由统一的`xinetd`管理,如果有客户端需要,再唤起相应服务,结束之后服务关闭释放系统资源,
启动方式: `/etc/init.d/xinetd start`
(一)例如:启动rsync(备份)服务
[root@linuxclient ~]# vim /etc/xinetd.d/rsync
service rsync
{
disable = no #将这里改成no,让rsync服务启动起来
flags = IPv6
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
[root@linuxclient ~]# /etc/init.d/xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
[root@linuxclient ~]# netstat -tnlp|grep 873
tcp 0 0 :::873 :::* LISTEN 8020/xinetd
这里PID后面的就是`xinetd`而不是`rsync`
(二)实验:修改配置文件(/etc/services/rsync)
service rsync
{
disable = no
bind = 127.0.0.1 #这是将此服务绑定在这个接口上
only_from = 127.0.0.0/8 #只开放此网段的源登录
no_access = 127.0.0.{100,200} #不允许这两个网段登录
instances = UNLIMITED #链接次数无限制
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
service rsync
{
disable = no
bind = 192.168.70.150
only_from = 140.116.0.0/16
only_from += .edu.tw #+=是在原来的基础上又增加的
instances = 10 #只有10条连接
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
[root@linuxclient ~]# netstat -tnpl |grep 873
tcp 0 0 :::873 :::* LISTEN 8354/xinetd
[root@linuxclient ~]# /etc/init.d/xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
[root@linuxclient ~]# netstat -tnpl |grep 873
tcp 0 0 192.168.70.150:873 0.0.0.0:* LISTEN 8438/xinetd
tcp 0 0 127.0.0.1:873 0.0.0.0:* LISTEN 8438/xinetd
其中遇到个问题,原来我的文件中有`flags=IPv6`结果就不成功,默认是`IPv4`
[root@linuxclient ~]# lsof -i :873
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
xinetd 9050 root 5u IPv4 117101 0t0 TCP localhost.localdomain:rsync (LISTEN)
xinetd 9050 root 6u IPv4 117102 0t0 TCP linuxclient.com:rsync (LISTEN)
除了更改配置文件以外,如果想将IP源或者某个域设置成不可访问或仅能访问,也可以在`/etc/hosts.deny`和`/etc/hosts.allow`里添加
(三)设置开机启动运行级别
`chkconfig`
`ntsysv`(红帽专有)
---------------
服务主要分为stand_alone和super daemon两种。
stand_alone:常驻在内存中的进程,可以独立被启动,启动方式: `/etc/init.d/... start`
super daemon:由统一的`xinetd`管理,如果有客户端需要,再唤起相应服务,结束之后服务关闭释放系统资源,
启动方式: `/etc/init.d/xinetd start`
(一)例如:启动rsync(备份)服务
[root@linuxclient ~]# vim /etc/xinetd.d/rsync
service rsync
{
disable = no #将这里改成no,让rsync服务启动起来
flags = IPv6
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
[root@linuxclient ~]# /etc/init.d/xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
[root@linuxclient ~]# netstat -tnlp|grep 873
tcp 0 0 :::873 :::* LISTEN 8020/xinetd
这里PID后面的就是`xinetd`而不是`rsync`
(二)实验:修改配置文件(/etc/services/rsync)
service rsync
{
disable = no
bind = 127.0.0.1 #这是将此服务绑定在这个接口上
only_from = 127.0.0.0/8 #只开放此网段的源登录
no_access = 127.0.0.{100,200} #不允许这两个网段登录
instances = UNLIMITED #链接次数无限制
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
service rsync
{
disable = no
bind = 192.168.70.150
only_from = 140.116.0.0/16
only_from += .edu.tw #+=是在原来的基础上又增加的
instances = 10 #只有10条连接
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
[root@linuxclient ~]# netstat -tnpl |grep 873
tcp 0 0 :::873 :::* LISTEN 8354/xinetd
[root@linuxclient ~]# /etc/init.d/xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
[root@linuxclient ~]# netstat -tnpl |grep 873
tcp 0 0 192.168.70.150:873 0.0.0.0:* LISTEN 8438/xinetd
tcp 0 0 127.0.0.1:873 0.0.0.0:* LISTEN 8438/xinetd
其中遇到个问题,原来我的文件中有`flags=IPv6`结果就不成功,默认是`IPv4`
[root@linuxclient ~]# lsof -i :873
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
xinetd 9050 root 5u IPv4 117101 0t0 TCP localhost.localdomain:rsync (LISTEN)
xinetd 9050 root 6u IPv4 117102 0t0 TCP linuxclient.com:rsync (LISTEN)
除了更改配置文件以外,如果想将IP源或者某个域设置成不可访问或仅能访问,也可以在`/etc/hosts.deny`和`/etc/hosts.allow`里添加
(三)设置开机启动运行级别
`chkconfig`
`ntsysv`(红帽专有)
0 0
- 认识系统服务(daemons)
- 认识linux系统服务(daemons)
- 系统服务(daemons)
- 第18章 认识系统服务(daemons)
- 认识系统服务daemons(转摘资料)
- 第十八章、认识系统服务 (daemons)
- 18章 认识系统服务(daemons)
- Day7:系统服务(daemons)
- Note For Linux By Jes(12)-认识系统服务(daemons)
- 鸟哥的Linux私房菜(基础篇)- 第十八章、认识系统服务 (daemons)
- 鸟哥的Linux私房菜10.24 系统服务(daemons)
- daemons与服务
- daemons和services(守护进程和服务)
- 认识系统服务
- 认识系统服务
- 认识android系统服务
- 认识系统服务
- 第十八章认识系统服务
- JAVA随堂笔记课【六】:数据类型,享元模式
- 【Modern OpenGL】第一个三角形
- 20151218 OCP 047 30-60
- @encode()是什么
- C++的一些知识
- 认识系统服务(daemons)
- HDU 1082 Matrix Chain Multiplication 逆波兰式
- Javascript 题目集-题壹
- Unity加载和内存管理机制(一)
- 树状数组-杭电-5592
- 最短路径算法—Dijkstra(迪杰斯特拉)算法分析与实现(Python)
- linux系统原理中的一些理解D
- swipe left for/swipe right for 中英文转换问题
- android notification设置提示音