FTP協議簡介
TFTP是用來下載遠程文件的最簡單網絡協議,它其於UDP協議而實現。
linux服務器端tftp-server的配置
1、安裝tftp服務器
需要安裝xinetd(守護tftp)、tftp和tftp-server 3個軟件
1)如果能上網,通過yum安裝:
sudo yum install xinetd
sudo yum install tftp
sudo yum install tftp-server
2、配置tftp服務器
修改/etc/xinetd.d/tftp文件,將其中的disable=yes改為disable=no。開啟TFTP服務
主要是設置TFTP服務器的根目錄,開啟服務。修改后的文件如下:
service tftp
{ socket_type =dgram
protocol =udp
wait =yes
user =root
server =/usr/sbin/in.tftpd
server_args =-s /home/mike/tftpboot -c
disable =no
per_source =11
cps =100 2
flags =IPv4
}
說明:修改項server_args= -s <path> -c,其中<path>處可以改為你的tftp-server的根目錄
參數-s指定chroot,-c指定了可以創建文件。
3、啟動tftp服務器並關閉防火牆
RedHat7+
systemctl disable firewall;systemctl stop firewall
systemctl enable xinetd;systemctl start xinetd
Redhat7-
/etc/init.d/iptables stop //關閉防火牆
sudo /sbin/service xinetd start
或service xinetd restart
/etc/init.d/xinetd start
看到啟動[OK]就可以了
4、查看tftp服務是否開啟
netstat -a | grep tftp
顯示結果為
udp 0 0 *:tftp *:*
表明服務已經開啟,就表明tftp配置成功了。
5、tftp使用
復制一個文件到tftp服務器目錄,然后在主機啟動tftp軟件,進行簡單測試。
登陸
tftp 192.168.1.2
tftp>get <download file>
tftp>put <upload file>
tftp>q
6、tftp命令用法如下
tftp your-ip-address
【進入TFTP操作】
connect:連接到遠程tftp服務器
mode:文件傳輸模式
put:上傳文件
get:下載文件
quit:退出
verbose:顯示詳細的處理信息
tarce:顯示包路徑
status:顯示當前狀態信息
binary:二進制傳輸模式
ascii:ascii傳送模式
rexmt:設置包傳輸的超時時間
timeout:設置重傳的超時時間
help:幫助信息
?:幫助信息
7、如果出現“AVC Denial, click icon to view”的錯誤,並不能傳輸文件
修改/etc/sysconfig/selinux,將SELINUX設定為disable
使用命令setenforce 0讓selinux配置文件生效
引用:
http://blog.sina.com.cn/s/blog_6e5e78bf0100qvmi.html