I need the correct syntax of tftp to get and put file. My ultimate goal is using busybox tftp (this should be second question), but it failed even trying to test with local Ubuntu tftp client.

As you can see below, ftp no issue, only tftp has issue. And this is loopback ip so shouldn't related to iptables (Again, ftp no issue). To prevent potential long path issue, I test with only home directory.

xb@dnxb:/tmp$ grep anon_root /etc/vsftpd.conf
xb@dnxb:/tmp$ cat /home/xiaobai/haha
xb@dnxb:/tmp$ ftp
Connected to
220 (vsFTPd 3.0.3)
Name ( anonymous
331 Please specify the password.
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> get haha
local: haha remote: haha
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for haha (2 bytes).
226 Transfer complete.
2 bytes received in 0.00 secs (6.5541 kB/s)
ftp> 221 Goodbye.
xb@dnxb:/tmp$ tftp
tftp> get haha
Error code 1: File not found
tftp> get /home/xiaobai/haha
Error code 1: File not found
tftp> get /home/xiaobai/haha output
Error code 1: File not found
tftp> put /home/xiaobai/haha        
Error code 1: File not found
tftp> put haha
Error code 1: File not found
tftp> xb@dnxb:/tmp$ dpkg-query -W -f='${Description}\n\n${Homepage}\nMaintainer: ${Maintainer}\n\n' tftp
Trivial file transfer protocol client
 Tftp is the user interface to the Internet TFTP (Trivial File Transfer
 Protocol), which allows users to transfer files to and from a remote machine.
 The remote host may be specified on the command line, in which case tftp uses
 host as the default host for future transfers.

Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>


Then I folllow this answer:

xb@dnxb:/tmp$ tftp -v -c get haha
usage: tftp host-name [port]
tftp> xb@dnxb:/tmp$ 
xb@dnxb:/tmp$ tftp -v -c get /home/xiaobai/haha
usage: tftp host-name [port]
tftp> xb@dnxb:/tmp$ 
xb@dnxb:/tmp$ tftp -v -c put haha
usage: tftp host-name [port]
tftp> xb@dnxb:/tmp$ tftp -v -c put /home/xiaobai/haha
usage: tftp host-name [port]
tftp> ^F
?Invalid command
tftp> xb@dnxb:/tmp$ 

And also this answer (comment out or not seems not effect, I did do service vsftpd restart after edited):

xb@dnxb:/tmp$ grep server_args /etc/xinetd.conf 
# server_args = -c -s /tftpboot

It could better if someone can give answer about busybox tftp which has different option:

# busybox tftp                                    
BusyBox v1.22.1 bionic (2017-11-04 12:54 +0800) multi-call binary.

Usage: tftp [OPTIONS] HOST [PORT]

Transfer a file from/to tftp server

        -l FILE Local FILE
        -r FILE Remote FILE
        -g      Get file
        -p      Put file
  • How have you configured tftpd on the server? Note that the most common use for tftp (that I know of) is for gabbing a bootloader binary off a server for booting a diskless system. It's not really used for general file transfer (partly because the tftp protocol, which is not the same as ftp, has no way of authenticating users).
    – Kusalananda
    Mar 7 '19 at 21:12
  • @Kusalananda I only install vsftpd and edit anon_root in /etc/vsftpd.conf. Yes, the deivce is a embedded device with pre-installed busybox tftp and out of my control to install other better client.
    – Fruit
    Mar 7 '19 at 21:18
  • 1
    Again, note that the FTP protocol is distinct from the TFTP protocol. vsftpd is, as far as I know, not a TFTP server. It is therefore not vsftpd that you connect against when using tftp.
    – Kusalananda
    Mar 8 '19 at 8:08

tftp is usually restricted to /tftpboot directory, I wouldn't expect it to work to get something from a user home directory.

Also check the file permissions. IIRC (it has been awhile), since tftp is unauthenticated files need to be world readable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.