TFTP Server 安裝: Debian/Ubuntu

From JK2410.org

Jump to: navigation, search

[編輯] 套件資訊

$ sudo dpkg -l tftpd-hpa
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
ii  tftpd-hpa      0.42-1ubuntu2  HPA's tftp server


[編輯] 安裝 tftpd-hpa

$ sudo apt-get install tftpd-hpa


[編輯] xinetd.conf 設定

安裝完tftp後,需要在xinetd的設定檔/etc/xinetd.conf中寫入相關設定。

$cat /etc/xinetd.conf
# Simple configuration file for xinetd
# Some defaults, and include /etc/xinetd.d/
defaults
{
# Please note that you need a log_type line to be able to use log_on_success
# and log_on_failure. The default is the following :
# log_type = SYSLOG daemon info
}
includedir /etc/xinetd.d

雖然我們可以將設定內容寫入此處,但還有更好的設定檔設定方法。xinetd.conf引入專門存放設定檔的資料夾includedir /etc/xinetd.d。因此更結構化的設定檔配置就是自己建立一個tftp設定檔於此資料夾內。

$sudo vim /etc/xinetd.d/tftp
存入
service tftp
{
       socket_type     = dgram
       protocol        = udp   
       wait            = yes
       user            = nobody
       only_from       = 140.113.180.2
       server          = /usr/sbin/in.tftpd
       server_args     = -s /var/lib/tftpboot
       disable         = no
       per_source      = 11
       cps             = 100 2
       flags           = IPv4
}

由於背景網路程式已經由inetd更換成xinetd,可將/etc/inetd.conf中關於tftp的部份註解以避免混淆。

#:BOOT: TFTP service is provided primarily for booting.  Most sites
#       run this only on machines acting as "boot servers."
#tftp           dgram   udp     wait    nobody  /usr/sbin/tcpd  /usr/sbin/in.tftpd /srv/tftp


完成設定後即可將欲放置於ftp的檔案移至 /var/lib/tftpboot 目錄下。

Views
個人工具
導航
工具