ubuntu12.04 Install TFTP, configure TFTP service error
But configured, my always appear error code 1:file not found errors, after exploring, TFTPD-HPA is a feature-enhanced TFTP server. It offers a lot of TFTP enhancements that have been ported to most modern UNIX systems
1, sudo apt-get install tftp-hpa tftpd-hpa xinetd
2, establish the configuration file
sudo vi/etc/xinetd.d/tftp
New File tftp
TFTP content:
Service TFTP
{
Disable = no
Socket_type = Dgram
protocol = UDP
Wait = yes
user = root
Server =/USR/SBIN/IN.TFTPD
Server_args =-s/tftpboot-c
Per_source = 11
CPS = 100 2
}
3, set up a TFTP service file directory
Mkdir/tftpboot
Modify permissions: sudo chmod 777/tftpboot-r
4, restart the service.
When the TFTP configuration file is configured, you need to restart the xinetd, enter sudo/etc/init.d/xinetd reload in the terminal, reload the process, and then enter sudo/etc/init.d/xinetd restart Restart the service.
Remember, every time you finish modifying the profile, you need to restart the service.
5, Installation Complete! Test method:
Put a file in the/tftpboot directory ABC
Then log in to another directory run TFTP 192.168.123.202//replace your IP
Go to the TFTP command line
Enter the get ABC to see if you can get the file down, if you can, or put the file up.
If the error code 1:file not found solution appears:
sudo vi/etc/default/tftpd-hpa
#/ETC/DEFAULT/TFTPD-HPA
Tftp_username= "TFTP"
tftp_directory= "/var/lib/tftpboot"//change to the one you want Tftpboot
Tftp_address= "0.0.0.0:69"
Tftp_options= "-l-c-S"//here is the option
Then remember to restart the service, sudo/etc/init.d/xinetd restart
If the above error, copy the file to/var/lib/tftpboot, and then try again, if successful, restart the system so that the above configuration takes effect.
Then you can use the tftpboot that you changed.
Finally configured out, the record is as follows:
1: Installation Services, a total of 3 services
1 sudo apt-get install TFTP-HPA tftpd-hpa xinetd
2: New configuration file/etc/xinetd.d/tftp
1 sudo vim/etc/xinetd.d/tftp
Note: If you are not the root user, add sudo, or the system will not allow TFTP, error
"/etc/xinetd.d/tftp" E212:can ' t open file for writing
Modify/ETC/XINETD.D/TFTP content as:
1 service TFTP
2 {
3 Disable = no
4 Socket_type = Dgram
5 protocol = UDP
6 wait = yes
7 user = root
8 Server =/USR/SBIN/IN.TFTPD
9 Server_args =-s/tftpboot-c
Ten Per_source = 11
One CPS = 100 2
12}
Note: In line Nineth
Server_args =-s/tftpboot-c
-c parameter is allowed to upload, parameter/tftpboot is your TFTP directory, modified to your directory, but I suggest that in the root directory, convenient
3: Modify the configuration file/etc/default/tftpd-hpa
1 sudo vim/etc/default/tftpd-hpa
Modified to:
1 #/ETC/DEFAULT/TFTPD-HPA
2 Tftp_username= "TFTP"
3 tftp_directory= "/tftpboot"//change to the one you want Tftpboot
4 tftp_address= "0.0.0.0:69"
5 tftp_options= "-l-c-S"//here is the option
4: Create a new Tftpboot directory under the root directory and modify the permissions
1 mkdir/tftpboot
2 sudo chmod 777-r/tftpboot
5: Create a new test file in/tftpboot
1 Touch Test
6: "Important" To restart the service, modify the configuration file anywhere to restart the service
1 sudo/etc/init.d/xinetd Reload
2 sudo/etc/init.d/xinetd Restart
7: Test Service TFTP is started
Netstat-a|grep TFTP
Show:
UDP 0 0 *:tftp *:*
Then start the service.
8: Test TFTP
Access to another directory "is not a/tftpboot directory, such as a user Jyg directory"
Cd/home/jyg
Test as shown:
9: Error occurred:
The error code 0:permission denied because the Tftpboot folder does not have permissions, or the file to upload and download does not have permissions.
"Resolve" Modify permissions
sudo chmod 777-r/tftpboot
Error code 1:file not found, reason 1: The specified file does not exist; reason 2:tftpd the-c option is not specified in the startup parameter; Reason 3: The directory has a problem because the default TFTP directory is "/var/lib/tftpboot" when installed , you can put the test file in this directory to be tested again, if the correct description of the conjecture is correct.
"Resolve" reason 1 and Reason 2 are all well resolved, here only to resolve the reason 3: Restart the service or reboot the system