我的程序是root,但只有在使用sudo启动时才能工作

时间:2012-06-20 15:55:21

标签: macos root ipfw

我写了一个小帮手工具来将规则提供给ipfw并启动一个dns-server。它与此shell脚本的作用相同:

#!/bin/sh

# run the dns server
./nin_mdns_osx 127.0.0.1 &

ipfw add 27000 fwd 127.0.0.1,53 ip from any to any dst-port 53
ipfw add 27101 fwd 127.0.0.1,8081 tcp from any to any dst-port 80

此脚本以sudo(预期)开始。我的helpertool也开始使用sudo工作(预期)。当我通过“chmod u + s”和“chown root”将其设为root时,帮助工具告诉我它是root(geteuid返回0) - 但它无法执行ipfw调用,而dns-server也无法bin (53号港口需要特权)。

我正在运行Osx 10.6.8。任何想法出了什么问题?

0 个答案:

没有答案