Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有谁能够帮助我?我正在使用 sphinx searcher,但我有很多数据库。我动态控制它们(更改 sphinx 配置文件),但是在我向配置文件添加索引后,sphinx 需要重新启动。我为此创建了一个 bash 脚本(停止 shpinx,启动它,索引器 --rotate --all ),当我从终端运行脚本时它没问题,但是当我从 apache 服务器运行时它不起作用。在不将 apache 服务器的所有者更改为 root 的情况下如何做到这一点(它会降低我服务器的安全性)?
在不将 apache 服务器的所有者更改为 root 的情况下如何做到这一点
sudo 怎么样?把这样的东西放在你的 sudoers 中......
apache ALL= NOPASSWD: /path/to/script command
关键是确保脚本不能被利用......因为它以root身份运行......即对于apache是只读+ exec,确保您发送到脚本的命令/开关经过健全性检查。
我希望这会有所帮助, 亲切的问候, 尼克