如何使每个人都可以从任何地方执行 Perl 脚本?

发布于 2024-07-21 06:28:53 字数 224 浏览 2 评论 0原文

我编写了一个非常简单的 Perl 脚本,现在我想让它从任何地方都可执行。

我知道我可以将其放入 /bin/ 中,将其从“mytest.pl”重命名 -> 'mytest' 和 chmod +x,但这是标准做法吗? 我注意到 /bin/ 中没有任何内容是 perl 脚本。

另外,我希望它能够登录到 /var/logs/mytest/*

是否有我应该注意的安全问题?

I wrote a very simple perl script, and now I want to make it executable from everywhere.

I know I could just drop it into /bin/, rename it from 'mytest.pl' -> 'mytest', and chmod +x, but is this standard practice? I noticed nothing in /bin/ is a perl script.

Also, I want it to be able to log to /var/logs/mytest/*

Are there any security issues I should be aware of?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

维持三分热 2024-07-28 06:28:53

最好将用户编写的脚本放在 /usr/local/bin 中,但是否值得担心这一点取决于您。 至于登录到 /var/logs/mytest/* ,您可以尝试使脚本 suid (出于安全考虑,有时不允许这样做)与可以写入该目录的用户,或者只是使 /var/logs/mytest 全局可写。

It is preferable to put user-made scripts in /usr/local/bin , but it's your call whether it's worth worrying about this. As far as logging to /var/logs/mytest/*, you can try to make the script suid (this is sometimes not allowed for security) with a user that can write to the dir, or just make /var/logs/mytest world-writable.

病毒体 2024-07-28 06:28:53

与其担心日志文件权限问题,为什么不记录到系统记录器呢? 这就是它的用途。 请参阅 Sys::Syslog

Instead of worrying about log file permissions issues, why not log to the system logger? That's what it's there for. See Sys::Syslog

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文