如何在 Upstart 中啟用使用者作業

如何在 Upstart 中啟用使用者作業

我試圖允許非特權使用者從他們的$HOME/.init目錄中執行新貴作業。

新貴食譜提到你必須啟用此功能,但沒有提到如何做。挫敗感可以歸納為@ropez 的評論:

文件似乎沒有提到如何要啟用使用者作業,它只提到配置文件,並且管理員必須執行此操作

當我嘗試start以非特權用戶身份工作時,我仍然收到此錯誤:

start: Rejected send message, 1 matched rules; type="method_call", sender=":1.70"

到目前為止我發現的最接近的要點是有人修補了 Upstart.conf,但它似乎比我在 Ubuntu 12.04 中使用的短很多。

有沒有一種規範的、定義明確的方法來做到這一點?

PS我知道有關的 問題。然而,他們的答案都沒有真正說明如何做到這一點。

答案1

您連結到的「已修補」Upstart 設定與隨附的 Upstart 設定相同新貴1.3(從無法讓新貴來運行使用者作業),所以我想說這是啟用使用者作業最簡單的方法。

答案2

此解決方案適用於 Ubuntu 12.04 上的 Upstart 1.5。

開啟新貴配置:

sudo vim /etc/dbus-1/system.d/Upstart.conf

註解掉該default策略,即

<policy context="default">
    ...
</policy>

並貼上塊這個補丁:

<!--
Allow any user to invoke all of the methods on Upstart, its jobs
or their instances, and to get and set properties - since Upstart
isolates commands by user.
 -->
<policy context="default">
    <allow send_destination="com.ubuntu.Upstart"
        send_interface="org.freedesktop.DBus.Introspectable" />
    <allow send_destination="com.ubuntu.Upstart"
        send_interface="org.freedesktop.DBus.Properties" />
    <allow send_destination="com.ubuntu.Upstart"
        send_interface="com.ubuntu.Upstart0_6" />
    <allow send_destination="com.ubuntu.Upstart"
        send_interface="com.ubuntu.Upstart0_6.Job" />
    <allow send_destination="com.ubuntu.Upstart"
        send_interface="com.ubuntu.Upstart0_6.Instance" />
</policy>

相關內容