Summary of steps for ubuntu to configure tftp services
- 2021-06-28 14:48:14
- OfStack
If tftp exists under/etc/xinetd.d/do the following
Shut down xinetd service
$sudo service xinetdstop
Delete tftp file
$sudo rm /etc/xinetd.d/tftp
Start the xinetd service
$sudo service xinetdstart
Install tftp client and server
$sudo apt-getinstall tftp-hpa
$sudo apt-getinstall tftpd-hpa
Modify the tftpd-hpa configuration file
$vim /etc/default/tftpd-hpa
modify " /var/lib/tftpboot " by " /tftpboot "
modify "--secure" by "--secure -c" Allow uploading of new files
Create the directory if/tftpboot does not exist
$sudo mkdir /tftpboot
$sudo chmod 777 /tftpboot
Restart the tftpd-hpa service
$sudo service tftpd-hpa restart
If the service restarts successfully, you can see the corresponding process
$ps -ef |grepin.tftpd
test
Execute commands at the terminal:
tftp Other party ip address
Download file: get file name
Upload file: put file name
Sign out: quit
Now that the tftp service has been installed, you can test it below. (Suppose you have a test file, test.txt, in the current directory
$tftp127.0.0.1
tftp> put test.txt
Sent 1018 bytes in 0.0seconds
tftp> get test.txt
Received1018 bytes in 0.1 seconds
tftp> quit
$
With the get command, you can upload the test.txt file in the current directory to its service file directory through tftp.At this point, the test.txt file appears below/tftpboot.With the put command, you can download the test.txt file from / tftpboot.This verifies the correctness of the tftp service configuration.When the file is uploaded and downloaded, you can exit with the quit command.