Linux操作系统tftp服务器搭建

软件安装

sudo apt install xinetd tftp-hpa tftpd-hpa

软件配置

tftp

sudo vi /etc/xinetd.d/tftp

配置如下(若/etc/xinetd.d/下无tftp,可自行创建):

service tftp
{ 
	socket_type = dgram
	wait = yes
	disable = no
	user = root
	protocol = udp
	server = /usr/sbin/in.tftpd
	server_args = -c -s /tftproot
	per_source = 11
	cps = 100 2
	flags = IPv4
}

tftpd-hpa

sudo vi /etc/default/tftpd-hpa
# /etc/default/tftpd-hpa
  
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftproot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-l -c -s"

69指的是端口号

TFTP_ADDRESS="0.0.0.0:69"

tftproot目录

创建目录

没错!这个目录就是上文配置中反复出现的目录的。
可以根据自己的喜好命名,也可以根据自己的喜好指定路径。

sudo mkdir /tftproot -p

修改权限

sudo chmod 777 /tftproot

重启服务

sudo /etc/init.d/tftpd-hpa restart
sudo /etc/init.d/xinetd restart

出现以下错误,说明端口号被占用,可修改/etc/default/tftpd-hpa中的端口号。

sudo /etc/init.d/tftpd-hpa restart
[....] Restarting tftpd-hpa (via systemctl): tftpd-hpa.serviceJob for tftpd-hpa.service failed because the control process exited with error code.
See "systemctl status tftpd-hpa.service" and "journalctl -xe" for details.
 failed!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值