tftp: server error: (2) Access violation

shah_pankil picture shah_pankil · Apr 6, 2015 · Viewed 14.9k times · Source

I am trying to send the file to tftp server using below command :

tftp -p -l test.txt xx.xx.xx.xx

And tftp usage is :

BusyBox v1.13.2 (2011-03-24 18:58:44 CDT) multi-call binary

Usage: tftp [OPTION]... HOST [PORT]

Transfer a file from/to tftp server

Options:

    -l FILE Local FILE
    -r FILE Remote FILE
    -g      Get file
    -p      Put file

Now with above command when I am trying to send the file but got this error:

tftp: server error: (2) Access violation

But if I create test.txt (filename that needed to send) in server manually and then try to transfer to server, it uploaded successfully.

How can I send the file without manual creation?

I am using xinetd service for tftp server. And below is its config file:

#/etc/xinetd.d/tftp :

service tftp
{
protocol = udp
port = 69
socket_type = dgram
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = /tftpboot/
disable = no
}

Please suggest changes to make it working without creation of a file in server.

Answer

Raashid Muhammed picture Raashid Muhammed · Jun 10, 2015

So this is how I debugged the issue.

# tail /var/log/syslog

The output of the above command said tftpd was serving files from /srv/tftp but there is no mention of /srv/tftp in /etc/xinetd.d/tftp.

Also this post helped to debug the issue: http://toddharris.net/blog/2011/06/19/debugging-xinetd-at-system-launch/. Running xinetd in debug mode did not cause this problem.

The culprit was the tftp line in /etc/inetd.conf as mentioned in the following link: http://www.beer.org/blog/category/tech-stuff.html Most probably when xinetd runs as a daemon, the /etc/inetd.conf takes precedence over the config files in /etc/xinetd.d directory and that is why this issue occurs when xinetd runs as a daemon.

Comment out the tftp line in /etc/inetd.conf and restart xinetd and that fixed this issue.