我使用选项--user tftp启动我的tftp服务器,以便它以用户tftp而不是根用户的身份运行。但是,ps显示该进程仍然以root的形式运行。
ps aux| grep tftp
root 2542 0.0 0.0 14856 324 ? Ss Jan11 0:00 /usr/sbin/in.tftpd --listen --user tftp -vvvvv -s -p --ipv4 /srv/tftpman tftpd说:
--user username, -u username
Specify the username which tftpd will run as; the default is "nobody".
The user ID, group ID, and (if possible on the platform) the supple‐
mentary group IDs will be set to the ones specified in the system
permission database for this username.用户tftp存在于我的系统上:
getent passwd | grep tftp
tftp:x:104:108:tftp daemon,,,:/srv/tftp:/bin/false有什么可能是错的?
发布于 2014-02-01 19:22:53
从源代码来看,TFTP守护进程似乎只在连接完成后才会删除根权限。
在tftpd.c中,在某一点上有一个
while (1) {行,并在循环的底部分叉子进程:
/*
* Now that we have read the request packet from the UDP
* socket, we fork and go back to listening to the socket.
*/
pid = fork();
if (pid < 0) {
syslog(LOG_ERR, "fork: %m");
exit(EX_OSERR); /* Return to inetd, just in case */
} else if (pid == 0)
break; /* Child exit, parent loop */
}
/* Child process: handle the actual request here */在下面的代码中,在某个点执行setuid调用以删除根权限
https://unix.stackexchange.com/questions/112040
复制相似问题