linuxsysctl

Is the sysctl.conf file always structured as /etc/sysctl.conf?


I need to know if all distributions of Linux have sysctl.conf be under /etc/sysctl.conf

I was told that Arch Linux does not. Can configurations set under the aforementioned path be overridden by another file in some distros?


Solution

  • Not always. RHEL8 has a dummy file quoting the man page of sysctl.d.

    man sysctl.d can read quite a few places.

    NAME
           sysctl.d - Configure kernel parameters at boot
    
    SYNOPSIS
           /etc/sysctl.d/*.conf
    
           /run/sysctl.d/*.conf
    
           /usr/lib/sysctl.d/*.conf
    

    A run of sysctl --system on a RHEL8 from the box evaluates files in this order:

    sysctl --system
    * Applying /usr/lib/sysctl.d/10-default-yama-scope.conf ...
    * Applying /usr/lib/sysctl.d/50-coredump.conf ...
    * Applying /usr/lib/sysctl.d/50-default.conf ...
    * Applying /usr/lib/sysctl.d/50-libkcapi-optmem_max.conf ...
    * Applying /etc/sysctl.d/50-libreswan.conf ...
    * Applying /usr/lib/sysctl.d/50-pid-max.conf ...
    * Applying /etc/sysctl.d/99-sysctl.conf ...
    * Applying /etc/sysctl.conf ...