【问题标题】:Install a daemon as non root in Yocto在 Yocto 中以非 root 身份安装守护进程
【发布时间】:2021-09-28 03:45:48
【问题描述】:
 if [ -f "${S}/abc/abcd.service" ]; then
      install -m 0644 ${S}/abc/abcd.service -D ${D}${systemd_unitdir}/system/abcd.service
      ln -sf ${systemd_unitdir}/system/abcd.service ${D}${systemd_unitdir}/system/multi-user.target.wants/abcd.service
      ln -sf ${systemd_unitdir}/system/abcd.service ${D}${systemd_unitdir}/system/ffbm.target.wants/abcd.service
 fi

我已经像上面一样安装了一个示例守护程序“abcd.service”,但在目标上,我看到它被列为 root。如果我选中“ps -ax | grep abcd”,那么它会显示我不想要的 root。 知道如何将其更改为非 root 用户吗?

【问题讨论】:

    标签: yocto bitbake yocto-recipe


    【解决方案1】:

    编辑 systemd 单元文件以使用 User=DynamicUser= 指令:https://www.freedesktop.org/software/systemd/man/systemd.exec.html?_sm_au_=iVVHkLwvwFJL8SMPL321jK0f1JH33#User=DynamicUser 指令可能更容易,因为您不必弄清楚如何在 Yocto 中创建新用户(也许实际上很容易,但我不知道该怎么做)。

    【讨论】:

    • 谢谢,我一发布问题就知道了。但也感谢您的评论:)
    猜你喜欢
    • 1970-01-01
    • 2016-04-11
    • 1970-01-01
    • 1970-01-01
    • 2016-10-18
    • 2015-08-19
    • 2020-01-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多