在 django 应用程序中使用 celery 以 root 权限运行脚本?

发布于 2024-09-24 10:21:55 字数 230 浏览 3 评论 0原文

我需要在我的 django 项目所在的 ubuntu 机器上运行一些命令,这些命令需要 root 权限,来自我的 django 项目。我正在使用 celery 启动异步进程,该进程依次调用需要 root 权限才能成功的 shell 命令。

我怎样才能做到这一点而不冒造成巨大安全漏洞的风险?

附言!我需要调用的shell命令是smbpasswd,编辑/etc/samba/smb.conf并重新启动samba服务。

I need to run some commands on my ubuntu box where my django project resides that requires root privileges, from within my django project. I'm using celery to fire off an asynch process, this process in turn calls shell commands that requires root privileges to succeed.

How can I do this without risking creating huge security holes?

PS! The shell commands I need to call are smbpasswd, edit /etc/samba/smb.conf and restart the samba service.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文