tftp install procedure

本文详细介绍如何在Linux系统中搭建TFTP服务器,包括安装必要软件包、配置服务参数、设置文件夹权限及验证服务正常运行等步骤。

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

step 1:首先需要安装tftp-hpa,tftpd-hpa,前者是客户端,后者是服务程序,在终端下输入 sudo apt-get install tftp-hpa tftpd-hpa,安装tftp-hpa和tftpd-hpa。然后还需要安装xinetd,在终端下输入 sudo apt-get install xinetd,安装好xinetd。

step 2: 进入根目录下的etc文件夹(cd /etc/),首先看目录中有没有一个xinetd.conf文件,如果没有则新建一个,有的话查看内容,看是否与下面的一致,若不一致则修改,内容如下:

# Simple configuration file for xinetd
#
# Some defaults, and include /etc/xinetd.d/

defaults
{

# Please note that you need a log_type line to be able to use log_on_success
# and log_on_failure. The default is the following :
# log_type = SYSLOG daemon info

}

includedir /etc/xinetd.d

step 3:配置tftp服务器
  命令:sudo vim /etc/default/tftpd-hpa

  将内容修改成

# /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftp"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-l -c -s"

step 4:然后进入xinetd.d文件夹(cd /etc/xinetd.d),查看是否有一个tftp文件,如果没有就新建一个,如果有的话就查看内容是否与下面的一致,不一致则修改,内容如下:

service tftp
{
	socket_type=dgram
	wait=yes
	disable=no
	user=root
	protocol=udp
	server=/usr/sbin/in.tftpd
	server_args=-s/tftp
	per_source=11
	cps=100 2
	flags=IPv4
}
<pre name="code" class="html">step 5: 修改所需文件夹的权限。需要修改的文件夹也就是上一步提到的那个服务器文件存放的文件夹,以我的配置文件为例,创建一个文件夹(sudo mkdir /tftp),然后把它可以设置成访问权限最宽松的(sudo chmod 777 /tftp),也可以设置成合适的权限。
step 6: restart the service.
    sudo service tftpd-hpa restart
    sudo /etc/init.d/xinetd reload
    sudo /etc/init.d/xinetd restart
step 7: verify the setup of tftp.
    1, make a new file in the /tftp folder, name is a.txt. command is "touch a.txt".
    2, switch into another folder, use command "tftp" to start the tftp service. and use command "get a.txt" to download the file, if there is no information returned, it is successful.
then you can find a file named a.txt in the current folder. You also can use command "put name.format" to upload file to the "tftp" folder.
use command "q" to terminate the service.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值