22.3. xinetd.d

本文介绍如何通过yum安装并配置TFTP与RSYNC服务。对于TFTP服务,不仅介绍了依赖于xinetd的方式,还提到了独立的atftp-server安装配置;而对于RSYNC服务,则详细展示了其xinetd配置文件的编辑过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


# yum -y install xinetd
		

22.3.1. tftpd

# yum install -y tftp-server tftp
			

/etc/xinetd.d/tftp

# vim /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
#       protocol.  The tftp protocol is often used to boot diskless \
#       workstations, download configuration files to network-aware printers, \
#       and to start the installation process for some operating systems.
service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /tftpboot
        disable                 = yes
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}
			

disable = yes 改为 disable = no

mkdir /tftpboot
/etc/init.d/xinetd restart
			
22.3.1.1. atftp-server
# yum install -y atftp-server atftp
				

/etc/xinetd.d/tftp

# cat /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer protocol. The tftp protocol is often used to boot diskless workstations, download configuration files to network-aware printers, and to start the installation process for some operating systems.
service tftp
{
    disable         = no
    socket_type     = dgram
    protocol        = udp
    wait            = yes
    user            = root
    server          = /usr/sbin/in.tftpd
    server_args     = /tftpboot
    per_source      = 11
    cps             = 100 2
    flags           = IPv4
}
				

atftp-server 是一个可以不依赖xinetd的tftp服务器

				

22.3.2. rsync

# vim /etc/xinetd.d/rsync
# default: off
# description: The rsync server is a good addition to an ftp server, as it \
#       allows crc checksumming etc.
service rsync
{
        disable = no
        socket_type     = stream
        wait            = no
        user            = root
        server          = /usr/bin/rsync
        server_args     = --daemon
        log_on_failure  += USERID
}

			

22.3.3. rshd

/etc/xinetd.d/rsh

# cat  /etc/xinetd.d/rsh
# default: on
# description: The rshd server is the server for the rcmd(3) routine and, \
#	consequently, for the rsh(1) program.  The server provides \
#	remote execution facilities with authentication based on \
#	privileged port numbers from trusted hosts.
service shell
{
	socket_type		= stream
	wait			= no
	user			= root
	log_on_success		+= USERID
	log_on_failure 		+= USERID
	server			= /usr/sbin/in.rshd
	disable			= no
}
			

访问权限配置

# cat /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.
#
in.rshd : your.example.com 192.168.0.1
			
# cat /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!
all : all
			

访问主机设置

# cat ~/.rhosts
your.example.com user
192.168.0.1	user
			

Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a>comments powered by Disqus




原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

<think>好的,我现在需要帮助用户解决在龙溪系统中无法打开/etc/xinetd.d目录以配置Telnet服务的问题。用户之前已经按照我的指导尝试配置,但遇到了问题。首先,我需要考虑可能的原因。 首先,用户提到的是龙溪系统,可能基于常见的Linux发行版,比如CentOS或RHEL,因为这些系统使用xinetd来管理服务。但用户无法访问该目录,可能原因有几个: 1. **目录不存在**:可能用户使用的系统版本或安装方式不同,导致xinetd没有安装,或者相关包未正确安装,所以目录没有被创建。 2. **权限问题**:用户可能没有足够的权限访问该目录,需要sudo或root权限。 3. **xinetd未安装**:如果用户没有安装xinetd,该目录自然不会存在。 4. **路径不同**:某些系统可能将配置文件放在其他地方,比如Debian系可能使用inetd而不是xinetd,但用户之前的问题中提到的是CentOS/RHEL,所以可能需要确认系统类型。 接下来,我需要逐步引导用户检查这些可能性。首先,检查目录是否存在。如果不存在,可能是xinetd未安装,需要安装。然后,确认权限问题,使用ls命令查看目录权限,可能需要sudo。如果目录确实不存在,建议用户安装xinetd包,并重新配置。 另外,用户可能混淆了系统类型,比如Ubuntu使用inetd而不是xinetd,所以需要确认系统版本,并给出相应的解决方案。用户之前的步骤中提到CentOS/RHEL使用xinetd,而Ubuntu使用inetutils-inetd,所以需要判断用户的实际系统类型。 同时,用户提供的引用中提到正在测试SSH版本的脚本,但当前问题与Telnet配置相关,需要专注于解决目录访问问题。可能需要提醒用户关于安全性的问题,但当前重点是解决配置问题。 最后,确保用户正确重启服务,并验证配置是否生效。如果所有步骤正确,但服务仍无法启动,可能需要检查日志文件,如/var/log/messages或journalctl -u xinetd来排查错误。</think>### 龙溪系统无法访问 `/etc/xinetd.d` 目录的解决方案 --- #### **步骤 1:验证目录是否存在** ```bash ls -l /etc/xinetd.d # 检查目录是否存在(需root权限) ``` - **现象 1**:报错`No such file or directory` **原因**:未安装`xinetd`服务管理工具或系统未使用xinetd架构 **解决方案**: ```bash sudo yum install xinetd -y # CentOS/RHEL sudo apt install xinetd -y # Debian/Ubuntu(非默认配置) ``` - **现象 2**:报错`Permission denied` **原因**:当前用户权限不足 **解决方案**: ```bash sudo ls /etc/xinetd.d # 使用管理员权限访问 ``` --- #### **步骤 2:修复配置文件缺失问题** 若目录为空或缺少`telnet`配置文件: 1. 手动创建配置文件: ```bash sudo vi /etc/xinetd.d/telnet # 创建新配置文件 ``` 2. 粘贴标准配置模板: ```bash service telnet { flags = REUSE socket_type = stream wait = no user = root server = /usr/sbin/in.telnetd log_on_failure += USERID disable = no } ``` --- #### **步骤 3:系统架构特殊处理** 若系统为**Debian/Ubuntu**且未使用xinetd: 1. 改用`inetd`配置: ```bash sudo vi /etc/inetd.conf # 直接修改主配置文件 ``` 2. 添加配置行: ``` telnet stream tcp nowait root /usr/sbin/tcpd /usr/sbin/in.telnetd ``` --- #### **步骤 4:服务重载与验证** ```bash sudo systemctl restart xinetd # CentOS/RHEL sudo systemctl restart inetutils-inetd # Debian/Ubuntu sudo netstat -tuln | grep :23 # 验证23端口监听状态 ``` --- ### **关键问题排查点** 1. **SELinux拦截**(CentOS/RHEL特有): ```bash sudo setenforce 0 # 临时关闭SELinux sudo vi /etc/selinux/config # 永久关闭需修改为SELINUX=disabled ``` 2. **日志分析**: ```bash journalctl -u xinetd --since "5 minutes ago" # 检查服务错误日志 ``` --- ### **安全增强建议** 1. **最低权限原则**:通过`/etc/xinetd.d/telnet`配置限制访问IP: ```bash only_from = 192.168.1.0/24 # 示例:仅允许内网访问 ``` 2. **协议替代方案**:推荐优先配置SSH服务(安全加密通道): ```bash sudo yum install openssh-server # CentOS/RHEL sudo apt install openssh-server # Debian/Ubuntu ``` --- ### 相关问题 1. 如何检测龙溪系统中xinetd服务是否正常运行? 2. Telnet服务配置完成后仍然无法连接,如何进行分层排查? 3. 在禁用SELinux的情况下如何保证系统安全性? [^1]: Telnet协议因明文传输特性已被NIST列为不安全协议,建议仅在封闭网络中使用(NIST SP 800-123
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值