How to Suppress Kernel Messages in SSH

If you have a firewall program or another program that regularly logs to the syslog, while in SSH or the console, you may be bombarded with messages that flood the console.

You may see messages like this:

DROP:IN=br0 OUT= MAC=xxx SRC=xxx DST=xxx LEN=60 TOS=0x00 PREC=0x00 TTL=128 ID=15731 DF PROTO=TCP SPT=63767 DPT=3493 WINDOW=8192 RES=0x00 SYN URGP=0

You can suppress these messages by the running the following command:

sysctl -w kernel.printk="3 4 1 3"

What this controls is the behavior of logging for error messages. The command stops low-level messages from outputting to the console, but still logs them to the error log for the current boot.

On reboot, the settings will revert back to normal. If you want to make this permanent, you can change or add the following line in /etc/sysctl.conf

kernel.printk = 3 4 1 3

You can check your current printk value at any time by running sysctl kernel.printk