permissions – 如何允许用户使用journalctl查看特定于用户的systemd服务日志?

我在Ubuntu 16.04 LTS中运行用户级服务.例如,我的test.service位于〜/ .config / systemd / user / test.service

我能够通过这样做来运行服务

systemctl --user start test.target

但是,当我尝试使用journalctl读取其日志时,我收到以下错误消息:

journalctl --user -u test.service
Hint: You are currently not seeing messages from other users and the system.
  Users in the 'systemd-journal' group can see all messages. Pass -q to
  turn off this notice.
No journal files were opened due to insufficient permissions.

如何将journalctl用于用户的特定单元?

在较旧的systemd版本中,您必须使用journalctl –user –user-unit = SERVICENAME(在较新的版本上,journalctl –user -u SERVICENAME将正常工作).

但是,这仅在/etc/systemd/journald.conf的[Journal]部分的Storage指令设置为persistent(而不是auto或volatile)时才有效.编辑配置文件后重新启动,用户将能够看到日志.

更多信息:
https://www.freedesktop.org/software/systemd/man/journald.conf.html
https://lists.freedesktop.org/archives/systemd-devel/2016-October/037554.html

相关文章

目录前言一、创建Hadoop用户二、更新apt和安装Vim编辑器三、...
原文连接:https://www.cnblogs.com/yasmi/p/5192694.html ...
电脑重启后,打开VirtualBox,发现一直用的虚拟机莫名的消失...
参见:https://blog.csdn.net/weixin_38883338/article/deta...
Ubuntu 18.04 LTS 已切换到 Netplan 来配置网络接口。Netpla...
介绍每个 Web 服务都可以通过特定的 URL 在 Internet 上访问...