How to give non-root user permission to run dmesg without su or sudo?

I want a non-root user to be able to open a terminal and run dmesg without needing to explicitly elevate privileges. I thought I could do this with sudoers, but it seems I don’t have this granularity, or it is not simple to set. Basically, I want the user to run a specific command as if it was local, not root.

Any easy way I can do this?

Thanks

An alternative to dmesg could be:

> journalctl -k

if you add the non-root user to group systemd-journal.

sysctl -w kernel.dmesg_restrict=0

Perfect, arvidjaar. Thanks!

Also thanks to rawar for the suggestion.

If you want to make it persistant, you can add it to a file in /etc/sysctl.d/ say, /etc/sysctl.d/01-dmesg.conf.txt
Then enter:

kernel.dmesg_restrict = 0

The spacers aroung ‘=’ are important, it doesn’t work without.

Tank you, kasi!

You’re welcome. :slight_smile:
(in spite of bad spelling of “persistent”…) :upside_down_face:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.