我如何sudo环境?

发布于 2024-07-27 18:45:11 字数 167 浏览 1 评论 0原文

我在 php 脚本中使用 spamassassin,但是当我作为我的用户训练 spamassassin 时,由于 sa-learn 的用户特定性质,php 脚本的 exec 命令调用 spamassassin 会得到未经训练的版本。 所以我需要在 exec 命令中对我的用户进行 sudo 并获取我的用户的环境以及权限

I am using spamassassin in a php script, but when I train spamassassin as my user the php script's exec command to call spamassassin get the untrained version because of the user specific nature of sa-learn. So I need to sudo to my user in the exec command and get the environment of my user along with the premissions

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

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

发布评论

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

评论(2

征棹 2024-08-03 18:45:11
sudo -u <username> <command> ...
sudo -u <username> <command> ...
小…楫夜泊 2024-08-03 18:45:11
sudo -H -u <username> <command>

-H 标志设置 $HOME 环境变量。 如果不设置此标志,SpamAssassin 可能会在旧用户的主目录中查找设置。

sudo -H -u <username> <command>

The -H flag sets the $HOME environment variable. Without setting this flag, SpamAssassin is probably looking in the old user's homedir for settings.

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