如何在没有 root 权限的情况下在 perl 中创建新的 HTTP::Daemon?
HTTP::Proxy 的第 271 行是这样的:
my $daemon = HTTP::Daemon->new(%args) or die "Cannot initialize proxy daemon: $!";
当我尝试运行此脚本时:
use CGI;
use CGI::Carp(fatalsToBrowser);
use HTTP::Proxy;
my $proxy = HTTP::Proxy->new( port => 8080 ); # Edit: I have tried other ports, too, including 3123, 32789, etc.
$proxy->start;
我从浏览器收到此错误消息:
软件错误:
无法初始化代理守护程序:HTTP/Proxy.pm 第 271 行不允许操作。
如需帮助,请发送邮件至该网站的网站管理员,并给出此错误消息 以及错误发生的时间和日期。
我认为这是因为我需要 root 权限。是否有我可以使用的不需要 root 权限的端口?我没有服务器的 root 密码。
编辑:显然我应该能够在没有 root 的情况下使用 1025 或更高版本启动它。我将如何设置堆栈跟踪?
Line 271 from HTTP::Proxy is this:
my $daemon = HTTP::Daemon->new(%args) or die "Cannot initialize proxy daemon: $!";
When I try to run this script:
use CGI;
use CGI::Carp(fatalsToBrowser);
use HTTP::Proxy;
my $proxy = HTTP::Proxy->new( port => 8080 ); # Edit: I have tried other ports, too, including 3123, 32789, etc.
$proxy->start;
I get this error message from the browser:
Software error:
Cannot initialize proxy daemon: Operation not permitted at HTTP/Proxy.pm line 271.
For help, please send mail to this site's webmaster, giving this error message
and the time and date of the error.
I assume this is because I need root permission. Are there any ports I can use that don't require root permission? I don't have the root password to the server.
Edit: Apparently I'm supposed to be able to start it without root with 1025 or greater. How would I set up a stacktrace?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 1025 以上的任何端口(尚未使用)。如果您在浏览器中收到该消息(在端口 8080 上?),则您的守护程序已成功使用该端口。我不确定它可能会带来哪些其他许可问题。您可以查看文档或尝试
strace
You can use any port (that is not already in use) above 1025. If you are getting that message in your browser (on port 8080?), your daemon is already successfully using that port. I'm not sure what other permission issues it might entail. You could check the documentation or try
strace