I am running TFTPD via xinetd on a Centos 5.4 server. I am able to access files via tftp fine, so I know the service is running ok. However, whenever I try and upload a file I get a 0 Permission denied message.
I have already created the file in /tftpboot and set the permissions to 666.
My tftpd config has verbose logging (-vvvv), but all I see in my /var/log/messages is:
START: tftp pid=20383 from=192.168.77.4
I have seen some mention that SELinux can prevent TFTPD uploads, but I'd expect to see something in the logs. I have SELinux set in permissive mode.
Any ideas?
Followed the info at http://grimwell.wikispaces.com/tftpd, paying particular attention to "rinse and repeat" in order to get the selinux policies in place. After a few attempts it all started working - uploading, and creation of new files.
In short:
-c -v -s /tftpboot
in the server args linegrep tftp /var/log/audit/audit.log | audit2allow -m tftpwrite
to create a selinux policy. Make sure that the policy includes write and create lines. If not, try writing and creating again to generate alerts in the audit log and try again.grep tftp /var/log/audit/audit.log | audit2allow -M tftpwrite
then install it usingsemodule -i tftpwrite.pp
service xinetd reload
and try using tftp.Splendid. Hope others find this useful!
I found another, better solution to this problem. I couldn't believe that the people who wrote the selinux policy files didn't think that people would need tftp uploads so I did some digging. I couldn't find anything on the internet that isn't already referenced here but by searching the selinux policy I was able to find another security context already on the system for tftp writes. Changing the context of /tftpboot fixed the problem.
Are you starting tftpd with the -s option? Some clients may be expecting this, e.g. uploading a file called
foo
to/foo
is really intended for/tftpboot/foo
on the server. Adding-s /tftpboot
essentially tells the server to do a "chroot" to that directory.Try running tftpd manually, e.g. not via xinetd, and see what the output is. You can also try running it with
strace
to see exactly which files it is attempting to open and which systems calls it is making.Double check
/etc/hosts.allow
and/etc/hosts.deny
to make sure traffic is being allowed into the server.With respect to SELinux, depending on how your system is configured it may be logging to
/var/log/audit/audit.log
if you have enabled auditd. See section 5 of this page.