Writing a perl cgi applications which runs as root

旧城冷巷雨未停 提交于 2019-12-02 08:30:21

You pretty much shouldn't.

If you can't avoid it, create a small and simple piece of code that runs with setuid root that does exactly that task and nothing more, or use sudo or similar to run a script that does just that.

Giving that file the appropriate permissions so that your web user can write to it (not necessarily read from it if that's not necessary) would be a better option.

Hameed

You must avoid doing that if you can at all times by all means.

If your program needs to write to the privileged file instantly, then go with Mat's reply. However, you can write the content somewhere else and run a cron job (say) every five minutes to copy the data.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!