I am trying to send/receive a file using TFTP from the network switch to ubuntu(VirtualBox on Windows 10 Pro), but getting an error code 5

By following the steps mentioned below it seems like my localhost is working with TFTP server, I can send and receive the file using localhost:

/home/abc# tftp localhost

tftp> put test

Sent 16 bytes in 0.0 seconds

tftp> get test

Received 16 bytes in 0.0 seconds

root@abc:/home/abc# ls -l /var/lib/tftpboot/
total 4
-rwxrwxrwx 1 root root 14 Sep  6 18:03 test

When I used the command in the switch to send/receive the file then I get the error message:

Trivial File Transfer Protocol

Opcode: Error Code (5)

[Destination File: test]

Error code: Access violation (2)

Error message: Access violation

[Expert Info (Warning/Response): TFTP ERROR packet]

[TFTP ERROR packet]

[Severity level: Warning]

[Group: Response]

Would you please guide me on how to fix this issue?


First, let’s install all the necessary packages:

sudo apt-get install xinetd tftpd tftp -y

Next, we need to create a configuration file:

sudo nano /etc/xinetd.d/tftp

Put the following content into the file.

service tftp
   protocol = udp
   port = 69
   socket_type = dgram
   wait = yes
   user = nobody
   server = /usr/sbin/in.tftpd
   server_args = var/lib/tftpboot -s
   disable = no

In the server_args, I have var/lib/tftpboot, which represents the location of the tftp root, i.e., /var/lib/tftpboot. Notice that I skip the root /.

Now let’s change the ownership of the directory:

sudo mkdir /var/lib/tftpboot
sudo chown -R nobody:nobody /var/lib/tftpboot
sudo chmod -R 777 /var/lib/tftpboot

and start the TFTP service:

sudo service xinetd stop
sudo service xinetd start

Verify the TFTP is running correctly or not:

netstat -na | grep LIST | grep 69
You should see something like this:
tcp        0      0    *     LISTEN

Test: Upload a file to TFTP Server Now let’s test the TFTP server by logging into the server first:

tftp localhost and upload a file:

tftp> put myfile.jpg
Sent 56733279 bytes in 5.7 seconds

Make sure that file has been uploaded:

ls -l /var/lib/tftpboot

Test: Download a file from TFTP Server Now, let’s go to a different directory and download the file we just upload.

cd some_other_directory

and log in to the tftp server again:

tftp localhost

and get the file:

tftp> get myfile.jpg
Received 56733279 bytes in 5.7 seconds

1 Answer 1


The issue was, switch network IP and Ubuntu machine IP address was on a different network. The problem has been resolved by setting the static IP address of my Ubuntu machine, same network IP as a switch IP.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .