AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 717725
Accepted
mike
mike
Asked: 2015-08-30 09:37:38 +0800 CST2015-08-30 09:37:38 +0800 CST 2015-08-30 09:37:38 +0800 CST

非 root 用户的 journalctl 访问权限

  • 772

journald 文档说,将用户添加到“systemd-journal”组或“adm”组允许用户访问系统范围的日志。

我正在运行最新的 CentOS 7,我似乎在以非 root 用户身份访问日志时遇到问题。

这是我的配置:

$ id
uid=1000(centos) gid=1000(centos) groups=1000(centos),4(adm),10(wheel),190(systemd-journal) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

$ cat /etc/systemd/journald.conf
[Journal]
Storage=persistent

$ journalctl
-- Logs begin at Sat 2015-08-29 16:35:52 UTC, end at Sat 2015-08-29 17:28:47 UTC. --
Aug 29 16:35:52 hostname ... <log continues>

journalctl 输出中没有系统日志。这是我的权限配置:

$ ll -a /var/log/journal/f9afeb75a5a382dce8269887a67fbf58/
total 24592
drwxr-xr-x. 2 root root     4096 Aug 29 16:35 .
drwxr-xr-x. 3 root root     4096 Aug 29 17:28 ..
-rw-r-----. 1 root root 16777216 Aug 29 17:27 system.journal
-rw-r-----+ 1 root root  8388608 Aug 29 17:33 user-1000.journal

如果我将所有权组更改system.journal为systemd-journal一切正常。但是,这似乎不对,因为文档没有说明任何内容。

有什么我遗漏的,还是实际上需要手动更改system.journal文件组?

谢谢

journald
  • 2 2 个回答
  • 11478 Views

2 个回答

  • Voted
  1. Best Answer
    mike
    2016-02-17T02:12:20+08:002016-02-17T02:12:20+08:00

    解决方案是在创建文件之前更改组所有权并在父文件夹中添加一个粘性位.journal。

    chown :systemd-journal /var/log/journal/f9afeb75a5a382dce8269887a67fbf58
    chmod g+s /var/log/journal/f9afeb75a5a382dce8269887a67fbf58
    
    • 7
  2. Attila123
    2020-04-07T06:12:38+08:002020-04-07T06:12:38+08:00

    好吧,我没有运行 Centos 7,但发现了这个问题。我做了这些步骤,但没有帮助,至少在 Ubuntu 18.04 上我收到一条消息

    Hint: You are currently not seeing messages from other users and the system.
          Users in groups 'adm', 'systemd-journal' can see all messages.
          Pass -q to turn off this notice.
    

    所以我确实sudo usermod -a -G systemd-journal my_user然后退出(从 ssh)并重新登录以使组更改生效,之后我可以看到我的普通用户的日志消息。

    • 5

相关问题

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve