Install, set up, and debug a tftp server on Ubuntu 12.04
Step 1: first describe that ubuntu is disabled by default by root, so you must first create a root user so that sudo is no longer needed:
$ Su root
Enter the password to obtain the Administrator account
Build a tftp service in Ubuntu
TFTP Server Configuration
Configure the TFTP download server in Ubuntu Linux
Configure tftp Server in Ubuntu 11.10
Step 2: Install the service
Install tftp-hpa tftpd-hpa xinetd
# Apt-get install tftp-hpa tftpd-hpa xinetd
Step 3: Create a folder/tftpboot (this is the file Exchange Directory of the server, which will be obtained from the folder when the client obtains the Server File in the future) and change the ACL of this folder to 777.
# Mkdir/tftpboot
# Chmod-R 777/tftpboot
Step 4: Modify the tftp configuration file. If not, create it. I like to use vim
# Vim/etc/xinetd. d/tftp
File Content:
Service tftp
{
Disable = no
Socket_type = dgram
Protocol = udp
Wait = yes
User = root
Server =/usr/sbin/in. tftpd
Server_args =-s/tftpboot // The file directory is the Server File Exchange Directory mentioned above.
Source = 11
CPIs = 100 2
Flags = IPv4
}
Step 5: Modify the inetd. conf file
# Vim/etc/inetd. conf
Generally, this file contains content when it is opened. You only need to add the following content at the end:
Tftp dgram udp wait nobody/usr/sbin/tcpd
/Usr/sbin/in. tftpd/tftpboot // The file directory is the Server File Exchange Directory mentioned above.
Step 6: Modify the tftpd-hpa File
# Vim/etc/default/tftpd-hpa
Content:
# RUN_DAEMON = "no"
# OPTIONS = "-s/home/zyp/tftpboot-c-p-U tftpd"
TFTP_USERNAME = "tftp"
TFTP_DIRECTORY = "/tftpboot" // The file directory is the Server File Exchange Directory mentioned above.
TFTP_ADDRESS = "0.0.0.0: 69"
TFTP_OPTIONS = "-l-c-s"
Step 7: restart the service
# Service tftpd-hpa restart
# Sudo/etc/init. d/xinetd reload
# Sudo/etc/init. d/xinetd restart
Step 8: Local Test
(1) create a test file under/tftpboot and modify the File Permission of test
# Cd/tftpboot
# Touch test
# Chmod 777 test
(2) Test the tftp service:
# Cd/
# Tftp 127.0.0.1
Tftp> get test
Tftp> q
# Ls
Check the current directory and find that the test file is already in the current directory. At this time, tftp is set up successfully!
Appendix: differences between tftp and ftp
TFTP is a simple protocol for transferring files. It is implemented by UDP, but we cannot determine that some TFTP protocols are based on other transmission protocols. This protocol is designed to transfer small files. Therefore, it does not have many FTP functions. It can only obtain or write files from the file server, but cannot list directories, and does not perform authentication. It transfers 8-bit data. There are three transmission modes: netascii, which is an eight-bit ASCII code format and octet, which is an eight-bit source data type. The last mail is no longer supported, it directly returns the returned data to the user rather than saving it as a file.