0%

Ubuntu TFTP Server 安裝

TFTP (Trivial File Transfer Protocol),是很常見的通訊協議用在一些小系統上,如 cisco 韌體更新、或是有些廠家會 BIOS 內建 tftp 下載 rom 檔功能。如此輕巧簡易的通訊協議就很常派上用場。

1. Install

  1. Install following packages.

    1
    sudo apt-get install xinetd tftpd tftp
  2. Create /etc/xinetd.d/tftp and put this entry

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    service tftp
    {
    protocol = udp
    port = 69
    socket_type = dgram
    wait = yes
    user = nobody
    server = /usr/sbin/in.tftpd
    server_args = /tftpboot
    disable = no
    }
  3. Create a folder /tftpboot this should match whatever you gave in server_args. mostly it will be tftpboot

    1
    2
    3
    sudo mkdir /tftpboot
    sudo chmod -R 777 /tftpboot
    sudo chown -R nobody /tftpboot
  4. Restart the xinetd service

    1
    2
    sudo /etc/init.d/xinetd stop
    sudo /etc/init.d/xinetd start

Now our tftp server is up and running.

2. Testing our tftp server

  1. Create a file named test with some content in /tftpboot path of the tftp server

    1
    2
    3
    4
     ls / > /tftpboot/test
    sudo chmod -R 777 /tftpboot
    ls /tftpboot/test -lh
    -rw-r--r-- 1 thalib thalib 159 2010-03-05 20:48 test
  2. Now in some other system follow the following steps.

1
2
3
4
5
tftp localhost
tftp> get test
Sent xxx bytes in 0.0 seconds
tftp> quit
cat test

3. 參考資料