
我已經設定了一個 debian wheezy 伺服器,並使用 runit 來保持我的服務正常運作。我還配置了 svlogd,但這就是我遇到問題的地方。當服務啟動時,我運行“ps aux”,我可以看到 svlogd 有錯誤:
runsvdir -P /home/[user]/service log:.rrent: /home/[user]/logs/gunicorn/: access denied sv
logd: pausing: unable to open current: /home/[user]/logs/celery/: access denied
我以我的使用者身分而不是 root 身分執行 runit 和 svlogd。如果我“tail ~/logs/celery/current”,我會看到以下內容:
2014-07-05_10:07:44.10589 If you really want to continue then you have to set the C_FORCE_ROOT
2014-07-05_10:07:44.10589 environment variable (but please think about this before you do).
2014-07-05_10:07:44.10589
2014-07-05_10:07:44.10590 User information: uid=0 euid=0 gid=0 egid=0
2014-07-05_10:07:44.10592
所以我不確定為什麼會出現訪問被拒絕的訊息
答案1
該錯誤是因為嘗試以 root 身分執行它時存在一個已知的安全漏洞,只有在必要時才應該這樣做。
如果您確實確定要繼續,可以透過以下方式從終端設定環境變數:
export C_FORCE_ROOT="true"
然而,該變數只會在您的會話期間持續。若要使其「永遠」持續,請將此行新增至您的 ~/.bashrc 或 ~/.profile 檔案中。
export C_FORCE_ROOT="true"
然後獲取該文件;
source ~/.bashrc