Diese Seite ist noch nicht übersetzt. Sie lesen die englische Fassung.

Linux kernel hardening with sysctl, in plain words

Aktualisiert: 2026-11-06

Sysctl is the list of settings the running Linux kernel lets you change without recompiling it. Hardening with sysctl means picking stricter values for the ones that affect security. Each setting is small, and most are safe. A few can break software you use, so the sensible approach is to start with the harmless ones and test the rest one at a time.

How it works

Read a value:

sysctl kernel.kptr_restrict

Change it until the next restart:

sudo sysctl -w kernel.kptr_restrict=2

Keep it across restarts by putting it in a file under /etc/sysctl.d/, whose files end in .conf and are read in name order:

echo 'kernel.kptr_restrict = 2' | sudo tee /etc/sysctl.d/90-example.conf
sudo sysctl --system

This works the same on Fedora, Ubuntu, Debian and Arch. Do not edit the files your distribution ships; add your own, so an update does not overwrite your work and you can remove it later. Because files are read in order, a later name wins when two set the same key.

Safe ones to start with

These change little for a desktop and have a clear benefit.

Some are probably set already on your system. Reading the value first tells you.

The ones that can break things

A stricter value can remove something that a program needs. Known cases:

The rule is simple: change one, use the computer for a day, and keep the rest for later.

How to test a change

After each change, use the machine as you normally do. Open your browser, start a Flatpak app if you use them, connect to your VPN, plug in a device, build something. If you work remotely, keep a second session open. Problems from sysctl changes tend to show up as one program failing with a “permission denied” or “operation not permitted” error that has no obvious cause, so when that happens right after a change, suspect the change first. Changing one value at a time makes the culprit obvious, and it makes the undo a single line.

Apply and undo

Note the current values before you change anything:

sysctl kernel.kptr_restrict kernel.dmesg_restrict

To undo a persistent change, remove the file and put the old value back, since deleting the file alone does not change the running kernel:

sudo rm /etc/sysctl.d/90-example.conf
sudo sysctl -w kernel.kptr_restrict=0

A restart also returns to whatever the remaining files and the kernel default say. If a setting stops something working and you do not know which, bisect: remove half of your file, run sudo sysctl --system, and test.

Check it with IbexWall

The Hardening screen lists 26 kernel, network, filesystem and module settings, each with what it can break, and you tick the ones you want. The Kernel hardening plugin (system.sysctl) reads each value, compares it with the reference and applies your choice through a plan. The plan shows the exact file, which IbexWall writes as /etc/sysctl.d/90-ibexwall.conf, and the diff before anything happens. A snapshot is taken first, and History undoes it. Version 1.0 is in preparation.

In diesem Ratgeber erwähnte Einstellungen