![Debian 在步骤 EXEC 生成时失败 - 系统服务 - 权限被拒绝](https://linux22.com/image/784315/Debian%20%E5%9C%A8%E6%AD%A5%E9%AA%A4%20EXEC%20%E7%94%9F%E6%88%90%E6%97%B6%E5%A4%B1%E8%B4%A5%20-%20%E7%B3%BB%E7%BB%9F%E6%9C%8D%E5%8A%A1%20-%20%E6%9D%83%E9%99%90%E8%A2%AB%E6%8B%92%E7%BB%9D.png)
我正在逐行严格遵循本教程: https://docs.meilisearch.com/learn/cookbooks/running_production.html#step-4-run-meilisearch-as-a-service
它有一个使用此配置将 Meilisearch 设置为服务的步骤:
cat << EOF > /etc/systemd/system/meilisearch.service
[Unit]
Description=Meilisearch
After=systemd-user-sessions.service
[Service]
Type=simple
WorkingDirectory=/var/lib/meilisearch
ExecStart=/usr/local/bin/meilisearch --config-file-path /etc/meilisearch.toml
User=meilisearch
Group=meilisearch
[Install]
WantedBy=multi-user.target
EOF
但是,当我按照建议运行它时,出现此错误:
systemd[1]: Started Meilisearch.
systemd[2834]: meilisearch.service: Failed to execute command: Permission denied
systemd[2834]: meilisearch.service: Failed at step EXEC spawning /usr/local/bin/meilise
systemd[1]: meilisearch.service: Main process exited, code=exited, status=203/EXEC
systemd[1]: meilisearch.service: Failed with result 'exit-code'.
但是,当我运行服务配置中指定的命令时,它运行完美:
/usr/local/bin/meilisearch --config-file-path /etc/meilisearch.toml
这是在 Debian 10 和 Debian 11 上。