Ozgur's Blog

Random ramblings of personal nature

Making dmesg accessable to normal users

With the latest kernel update, we can't use dmesg command as a normal user any more. This change is done with security in mind - a lot of information is dumped into dmesg and can be used for privilege escalation.

If you want to override this behavior this is what you should do.

If you get this error after dmesg command, you are in secure mode - as in only superuser can see the dmesg output:

dmesg: read kernel buffer failed: Operation not permitted

To make it accessible to normal users:

sudo sysctl kernel.dmesg_restrict = 0

to unlock your dmesg output right now and to make it permanent:

echo 'kernel.dmesg_restrict=0' | sudo tee -a /etc/sysctl.d/99-sysctl.conf