1,安裝相關軟件包:tftpd(服務端),tftp(客戶端),xinetd
$sudo apt-get install tftpd tftp xinetd
2,建立配置文件
在 /etc/xinetd.d/ 下建立一個配置文件 tftp$sudo gedit tftp
在文件中輸入以下內容:
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
3,建立 ubuntu tftp 服務文件目錄(上傳文件與下載文件的位置),並且更改其權限
$sudo mkdir /tftpboot
$sudo chmod 777 /tftpboot -R
4,重新啓動服務$sudo /etc/init.d/xinetd restart
至此 ubuntu tftp 服務已經安裝完成了,下面對其進行測試(假設在當前目錄下有一個測試文件 test.txt)
$tftp 127.0.0.1
tftp> put test.txt
Sent 1018 bytes in 0.0 seconds
tftp> get test.txt
Received 1018 bytes in 0.1 seconds
tftp> quit
如果出現無法get或者put的時候,可以查看一下防火牆是否關閉。
如果遇到錯誤提示信息 “Access violation”,表示文檔沒有讀的權限
將檔案 file1.txt 設爲所有人皆可讀取 :
$sudo chmod a+r file1.txt