This is controlled by the dmesg_restrict
sysctl
entry, documented in the kernel documentation. Its default value is determined by the CONFIG_SECURITY_DMESG_RESTRICT
kernel configuration value, which is typically enabled in modern distributions.
You can see the current value by running
/sbin/sysctl kernel.dmesg_restrict
and change its value using (as root
)
sysctl -w kernel.dmesg_restrict=1
(to enable the restriction) or
sysctl -w kernel.dmesg_restrict=0
(to disable it and restore the old behaviour).
To make this change permanent (automatically applied at boot), write it to /etc/sysctl.conf
or a configuration file under /etc/sysctl.d
:
echo kernel.dmesg_restrict=0 | sudo tee -a /etc/sysctl.d/99-dmesg.conf