# Getting tftpd to work

## eflothmeier

My goal is to install firmware into a Linksys router I

downloaded the firmware *.img, and would like to install

it on the target router:

Installed tftp-hpa:

and made it part of xinetd:

This is from the xinetd.conf file

.

.

.

service tftp

{

	socket_type	= dgram

	protocol	= udp

	wait		= yes

	disable		= no

	user		= root

	server		= /usr/sbin/in.tftpd

	server_args	= -s /tftpboot

}

.

.

.

currently it fails the self test:

erich@mmom ~/Firmware $ tftp localhost

tftp> get bkm

Transfer timed out.

No wonder. listening on port 69 is not there

mmom erich # netstat -alntp

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    

tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN      3104/xinetd         

tcp        0      0 0.0.0.0:23              0.0.0.0:*               LISTEN      3104/xinetd         

tcp        0      0 0.0.0.0:6000            0.0.0.0:*               LISTEN      2262/X              

tcp6       0      0 :::6000                 :::*

Checked /etc/services file and port 69 is not commented out

Looked at

https://forums.gentoo.org/viewtopic-t-1019766.html

and it looks like he got further, but I don't see how.

----------

## Hu

You set protocol=udp, then you listed TCP sockets.  UDP sockets are not TCP sockets.  What is the output of ss -nul?

----------

## eflothmeier

Sorry to confuse people. I meant to say

"tftp" in the subject title and not "tftpd"

----------

## eflothmeier

See if this is helpful:

erich@mmom ~/Firmware $ tftp -v localhost

Connected to localhost.localdomain (::1), port 69

tftp> get bkm

getting from localhost.localdomain:bkm to bkm [netascii]

Transfer timed out.

tftp>

To answer your question:

mmom ~ # ss -nul

State       Recv-Q Send-Q                    Local Address:Port                      Peer Address:Port 

UNCONN      0      0                                     *:68                                   *:*     

UNCONN      0      0                                     *:69                                   *:*

...and with tftp running as user

mmom ~ # ss -nul

State       Recv-Q Send-Q                    Local Address:Port                      Peer Address:Port 

UNCONN      0      0                                     *:68                                   *:*     

UNCONN      0      0                                     *:69                                   *:*     

UNCONN      0      0                                    :::44656                               :::*

----------

## eflothmeier

Maybe it just works:

```

mmom ~ # netstat -alnup

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    

udp        0      0 0.0.0.0:68              0.0.0.0:*                           2000/dhcpcd         

udp        0      0 0.0.0.0:69              0.0.0.0:*                           2083/xinetd

```

As you may have noticed, I don't post frequently. This is also message testing.

Think there may be a permission problem when tftp is run as user

----------

## eflothmeier

Many attempts have been tried. Thus far tftp has

never passed the self test.

One of the reasons tftp is non-trivial is that it is so stark.

Unlike ftp, there is no facility for showing/listing a directory once

a connection is made. Another is that there are so many recipes

for making it run. Since we installed tftp-hpa maybe a recipe

from there might work. One of the variable things is the server_args

directory.It's all over the place. Here's a sampler

/tftpboot

/home/user/tftptest

/var/lib/tftpboot

/srv/tftp

If there is a permission problem. I've never noticed error

messages to that effect.

Decided to use /var/lib/tftpboot because it has root permission

and doesn't add a new directory to the root '/'

Decided to set kernel flags:

NF_CONNTRACK_TFTP [=y]

NF_NAT_TFTP [=m]

and rebuild & install

For the first time ever, it has worked:

server:

mmom opentftp # ./opentftpd -v

client:

erich@mmom ~/tftptest $ tftp -v mmom

Connected to mmom.fgi.com (192.168.0.100), port 69

tftp> put bkm

putting bkm to mmom.fgi.com:bkm [netascii]

Sent 272 bytes in 0.0 seconds [116053 bit/s]

tftp>

Had to use mmom (the local host) using localhost still

doesn't work

----------

