Linux系统基础指令——tftp命令
摘要:TFTP是用来下载远程文件的最简单网络协议,它其于UDP协议而实现。Linux tftp命令用于传输文件,让用户得以下载存放于远端主机的文件,也能将文件上传到远端主机放置。tftp是简单的文字模式ftp程序,它所使用的指令和FTP类似。本文将介绍tftp命令的使用方法,详细内容参考下文。
一、命令行格式
tftp(选项)(参数)
命令格式解读如下:
1、选项
-c:指定与tftp服务器连接成功后,立即要执行的指令;
-m:指定文件传输模式。可以是ASCII或者Binary;
-v:显示指令详细执行过程;
-V:显示指令版本信息。
2、参数
主机:指定tftp要联机的tftp服务器的ip地址或主机名。
二、安装TFTP服务器
1、登陆系统

2、安装TFTP
执行指令# yum install xinetd安装xinetd

执行指令# yum install tftp安装tftp

执行指令# yum install tftp-server安装tftp-server

3、配置tftp服务器
修改/etc/xinetd.d/tftp文件,将其中的disable=yes改为disable=no。主要是设置TFTP服务器的根目录。如下图

备注:修改项server_args= -s <path> -c,其中<path>改为已设置好的tftp-server的根目录,参数-s指定chroot,-c指定了可以在该目录下创建文件。
4、启动tftp服务器并开放端口
执行指令# systemctl start xinetd启动tftp服务

执行指令# firewall-cmd --add-port=69/udp –permanent开放69udp端口

5、查看tftp服务是否开启
执行指令# netstat -a|grep tftp查看服务

三、TFP使用测试
1、tftp命令用法# tftp ip-address
