2010年6月18日

安裝TFTP Server for ubantu

TFTP-Trivial File Transport Protocol
需要tftpd-hpa和xinetd這兩支程式
sudo apt-get install tftpd-hpa xinetd

建立tftp設定檔,讓呼叫tftp daemon時會來這邊找config檔
sudo vi /etc/xinetd.d/tftp
輸入
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}

存檔後,需要再讓xinetd重新啟動,以讀取新的設定檔
sudo /etc/init.d/xinetd restart


建立/tftpboot目錄及設定權限
sudo mkdir /var/lib/tftpboot
sudo chmod 777 /var/lib/tftpboot

若/tftpboot有檔案時要將/tftpboot目錄內的檔案的權限設成666
cd /var/lib/tftpboot
chmod 666 *

如果要將檔案上傳到tftpserver
先執行touch /var/lib/tftpboot/test.txt (建立上傳的檔名)
chmod 666 /var/lib/tftpboot/test.txt

最後即可連到tftp server測試
測試下載
happylucky@ubuntu:~$ tftp 192.168.0.113
tftp> get test.txt
tftp> quit
測試上傳
happylucky@ubuntu:~$ tftp 192.168.0.113
tftp> put test.txt
tftp> quit

0 回應:

Copyright © 2009 New Life in Taipei All rights reserved. Theme by Laptop Geek. | Bloggerized by FalconHive.