1. Install tftp-hpa tftpd-hpa
sudo apt-get install tftp-hpa tftpd-hpa2. Creat a folder under home of user.
cd ~mkdir tftp
sudo chmod 777 -R tftp
Method 1:
Modify configuration file.
vim /etc/default/tftpd-hpa
# /etc/default/tftpd-hpa
TFTP_DIRECTORY="/home/freeman/tftp"
TFTP_ADDRESS="0.0.0.0:69"
#TFTP_OPTIONS="--secure"
TFTP_OPTIONS="-l -c -s"
Service start.
sudo service tftpd-hpa restartMethod 2:
Service start.
sudo /usr/sbin/in.tftpd --listen --address 0.0.0.0:69 -l -c -s /home/freeman/tftp/
3. Test enviroment.
Create a file name "download.txt" at tftp folder
A. Download
tftp> get download.txt
tftp> q
B. Upload
tftp> put upload.txt
tftp> q
Question:
Q: Error code 2: Only absolute filenames allowedA: sudo in.tftpd -l /home/happy/tftp(depend on which server folder you place)
Q: If tftpd can't work
ps -aux | grep tftpd (can't see the process)
A: In the terminal, please type follow command
/usr/sbin/in.tftpd --listen --user tftp --address 0.0.0.0:69 -l -c -s /home/freeman/tftp
Reference:
Bash script
# Configuration tftpd (Bash script)
bash -c 'mkdir ~/tftp'
bash -c 'echo "TFTP_USERNAME="tftp"" >> ~/tftpd-hpa >> ~/tftpd-hpa'
bash -c 'echo "TFTP_DIRECTORY="/home/freeman/tftp"" >> ~/tftpd-hpa'
bash -c 'echo "TFTP_ADDRESS="0.0.0.0:69"" >> ~/tftpd-hpa'
bash -c 'echo "TFTP_OPTIONS="-l -c -s"" >> ~/tftpd-hpa'
bash -c 'sudo cp ~/tftpd-hpa /etc/default/'
bash -c 'sudo service tftpd-hpa restart'
0 意見:
張貼留言