I am running Cygwin64 on two Win10 machines, one Home and one Pro. My software uses tftpd to receive a CSV from a network peer. tftpd is run from init (package sysvinit) with this line:
td:2345:respawn:/usr/sbin/tftpd -vvvvv -L -c -p -u Larry -U 000 -s /tmp
There is no xinetd running, no xinetd or tftp configuration file that I know of. On the Win10 Home system, which is my development system, this works. On the Win10 Pro system, it fails. The client times out. There is no entry in /var/log/messages (syslog-ng). Windows Application Log says "Cannot drop privileges: operation not permitted"
When I stop init and run that command line in a shell, it works and clients can transfer files in. But my system needs the respawn management of init. The pattern was set 12 years ago with Cygwin32 on Win7. My customer is now updating the PC and we have this glitch. If I were developing now, I would put the function on a raspi, but this is just a PC change.
Can anyone recommend a configuration to get the execution of tftpd under init under cygwin under Win10 Pro closer to that of the same command line in a user shell?
Edit 1: I also tried suid. tftpd.exe is owned by the user account, not SYSTEM or whatever cygwin has for root. Suid does not set permissions in a way that solves the problem.
Edit 2: adding cygdrop to the inittab line does not help.
Short version: Remove
tftpandtftp-server, and installinetutils-serverandinetutilsfor the old version. Remove-u USERflag when running tftpd. The old tftp version doesn't require dropping privilege.Longer story:
I tried picking up where you left off, found some resources... wasted hours.
From
/usr/share/doc/Cygwin/tftp.READMErun
tftpd-configto create the unprivileged local account tftpd.After this, I still couldn't run it. I tried
net user tftpd /active:YESand found that the user is now created but needs the password updated to meet policy requirements. I created a password and was able to enable the user.Still fails:
$ /usr/sbin/tftpd -vvv -c -L -p -U 022 -u tftpd -s /tftpboot. Windows still says no user tftpd. From my xinetd install, I recall that the service nomenclature is computername+account. I modify my command to$ /usr/sbin/tftpd -vvv -c -L -p -U 022 -u mycomputer+tftpd -s /tftpbootand it now runs!Attempting to push a file to my computer still fails. Windows application logs now say
tftpd: PID 2467: cannot drop privileges: Operation not permittedI gave up too.
I did find in the
/usr/share/doc/Cygwin/tftp.READMESo I removed tftp, and installed inetutils-server and inetutils in favor of the old version of tftpd. Removed
-u USERflag BOOM! Works.