[Ubuntu] TFTP service

TFTP service

Step 1. Install the tftp package
apt-get install tftp-hpa tftpd-hpa
 
Step2. Create the tftp directory
mkdir /tftpboot # create a folder as the tftp directory
sudo chmod 0777 /tftpboot
sudo touch test.txt # create a file test.txt for transfering
 
Step3. Configure
# vi /etc/default/tftpd-hpa
TFTP_USERNAME=”tftp”
TFTP_DIRECTORY=”/tftpboot” # this is the tftpd-hpa service directory
TFTP_ADDRESS=”0.0.0.0:69″
TFTP_OPTIONS=”-l -c -s” # -c means upload the file,-s  means the tftpd-hpa service directory
 
Step4. Restart the service
 sudo service tftpd-hpa restart #restart the service to take it effective.
 
Step5. Tftp test
# cd /home
# tftp localhost      or tftp [IP]
tftp>get test.txt     //Download test, test.txt  in  /tftpboot
tftp>put test1.txt //Upload test, test1.txt in /home
tftp>q