Cygwin tftpd 无法删除权限?

问题描述 投票:0回答:2

我在两台 Win10 机器上运行 Cygwin64,一台是家庭版,一台是专业版。我的软件使用 tftpd 从网络对等点接收 CSV。 tftpd 从 init(sysvinit 包)运行,并使用以下行:

td:2345:respawn:/usr/sbin/tftpd -vvvvv -L -c -p -u Larry -U 000 -s /tmp

据我所知,没有 xinetd 正在运行,也没有 xinetd 或 tftp 配置文件。在我的开发系统Win10 Home系统上,这是可行的。 在Win10 Pro系统上,失败。客户端超时。 /var/log/messages (syslog-ng) 中没有条目。 Windows 应用程序日志显示“无法删除权限:不允许操作”

当我停止 init 并在 shell 中运行该命令行时,它可以工作并且客户端可以传输文件。但是我的系统需要 init 的重生管理。该模式是 12 年前 Win7 上的 Cygwin32 设定的。我的客户现在正在更新电脑,我们遇到了这个故障。如果我现在进行开发,我会把该功能放在 raspi 上,但这只是 PC 的更改。

谁能推荐一种配置,让 tftpd 在 Win10 Pro 下 cygwin 下的 init 下执行,更接近用户 shell 中同一命令行的执行情况?

编辑1:我也尝试过suid。 tftpd.exe 由用户帐户拥有,而不是 SYSTEM 或任何 cygwin 为 root 拥有的帐户。 Suid并没有以解决问题的方式设置权限。

编辑 2:将 cygdrop 添加到 inittab 行没有帮助。

windows cygwin daemon init tftp
2个回答
0
投票

我猜这将是另一种风滚草。经过3天的磨练,我没有找到好的答案。问题似乎涉及 Windows 中的域用户与本地用户,以及 Cygwin 如何与 Windows 用户数据库交互(无论是什么)。我最终在一个无限循环批处理文件中运行 tftp 服务器,该批处理文件在用户登录时启动,但很容易受到有人杀死顶级 shell 的影响。在此过程中,我为 Cygwin 重新编译了 tftpd-hpa 并注释掉了用户 ID 更改 - 这在我的 PC 上有效,但在客户的 PC 上无效。如果他们对解决方案有疑问,我可能会重新定位到 raspi。


0
投票

简短版本: 我删除了

tftp
tftp-server
,并安装了
inetutils-server
inetutils
中包含的旧版本 删除了
-u USER
旗帜 BOOM!有效。

更长的故事:

我尝试从你上次停下的地方继续,找到了一些资源......浪费了时间。

来自

/usr/share/doc/Cygwin/tftp.README

运行

tftpd-config
创建非特权本地帐户 tftpd。

$ /usr/bin/tftpd-config
*** Info: Initially, tftpd runs as a privileged user in order to
*** Info: chroot for security. However, it immediately drops privileges
*** Info: but needs an ordinary, unprivileged user account to do so.
*** Query: Create an unprivileged user 'tftpd' for this purpose? (yes/no) yes
*** Info: Note that creating a new user requires that the current account have
*** Info: Administrator privileges.  Should this script attempt to create a
*** Query: new local account 'tftpd'? (yes/no) yes
*** Query: Overwrite existing /etc/inetd.d/tftp file? (yes/no) yes
*** Info: Creating default /etc/inetd.d/tftp file
*** Info: Updated /etc/inetd.d/tftp

*** Info: tftpd configuration finished. Have fun!
*** Info: If you did NOT install tftpd as a standalone service, then
*** Info: you may need to modify /etc/inetd.d/tftp or /etc/xinetd.d/tftp
*** Info: depending on which superserver you wish to use to control
*** Info: tftpd

此后,我仍然无法运行它。我尝试了

net user tftpd /active:YES
,发现用户现已创建,但需要更新密码以满足策略要求。我创建了一个密码并能够启用该用户。

$ net user tftpd /active:YES
The command completed successfully.

仍然失败:

$ /usr/sbin/tftpd -vvv -c -L -p -U 022 -u tftpd -s /tftpboot
。 Windows 仍然显示没有用户 tftpd。 从我的 xinetd 安装中,我记得服务命名法是计算机名+帐户。我将命令修改为
$ /usr/sbin/tftpd -vvv -c -L -p -U 022 -u mycomputer+tftpd -s /tftpboot
,它现在运行了!

尝试将文件推送到我的计算机仍然失败。 Windows 应用程序日志现在显示

tftpd: PID 2467: cannot drop privileges: Operation not permitted

我也放弃了。

我确实在

/usr/share/doc/Cygwin/tftp.README

中找到了
The tftp-hpa tftpd server differs from inetutils one, with respect to how
user privileges are handled.  The inetutils tftpd requires that tftpd be

所以我删除了 tftp,并安装了 inetutils-server 和 inetutils,转而使用旧版本的 tftpd。 删除了

-u USER
旗帜 BOOM!有效。

© www.soinside.com 2019 - 2024. All rights reserved.