Linux prevent unprivileged users from viewing dmesg

Originally published at: https://www.cyberciti.biz/faq/how-to-prevent-unprivileged-users-from-viewing-dmesg-command-output-on-linux/

I want to restrict both normal users and root user inside LXD container “hypervisor” from viewing and using dmesg command output. How do I prevent non-root (unprivileged) Linux users from viewing the Linux kernel’s log buffer? Can Linux prevent unprivileged users from viewing dmesg command output?

You must access root privilege to see kernel log
Regular user can’t see log of kernel