klogctl: Operation not permitted

In recent releases of slackware I have noticed that dmesg is disabled by default for non-privileged users. I can imagine why this is done server installations, but it is somewhat of a nuisance on single user machines.  Nonetheless, this can be quickly remedied.

grepping for 'dmesg' in the run start scripts (/etc/rc.d/rc.*) you will find the following ->

/etc/rc.d/rc.M:/bin/dmesg -s 65536 > /var/log/dmesg
/etc/rc.d/rc.M.new:# Set the permissions on /var/log/dmesg according to whether the kernel
/etc/rc.d/rc.M.new:# permits non-root users to access kernel dmesg information:
/etc/rc.d/rc.M.new:if [ -r /proc/sys/kernel/dmesg_restrict ]; then
/etc/rc.d/rc.M.new:  if [ $(cat /proc/sys/kernel/dmesg_restrict) = 1 ]; then

The interesting string is -> if [ $(cat /proc/sys/kernel/dmesg_restrict) = 1

It is logical to suspect that the setting is indeed '1' for restrictive access to dmesg kernel messages. Simply doing the following as root resolves the problem

echo "0" > /proc/sys/kernel/dmesg_restrict  and of course to confirm that the previous command worked as desired.

The following command should result in "0"

cat /proc/sys/kernel/dmesg_restrict  and indeed it does on my system.

Now you can exit root shell and retry dmesg as non-privileged user.

  • Wonders of setgid
  • Slackware Excursions - Rescuing a failed LUKS / LVM install
  • Foray into hardware virtualization - QEMU / KVM
  • Authors abound
  • Monthly Archives

    Pages

    OpenID accepted here Learn more about OpenID
    Powered by Movable Type 4.25

    About this Entry

    This page contains a single entry by AG published on November 17, 2013 7:56 AM.

    Dry Loop Musings was the previous entry in this blog.

    Release the Killer B's is the next entry in this blog.

    Find recent content on the main index or look in the archives to find all content.