I'm fairly new in Linux, looking for a solution to entirely ban kernel module to load.
I know how to unload module but need to prevent it before module loads on boot.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
Check the module name first:
lsmod | less
Then let say loaded module name is my_proc_to_ban
go and create a script such as :
echo' install my_proc_to_ban /bin/false ' >> /etc/modprobe.d/blacklist.conf
That will prevent to boot or run your module
or as in your case, server is yours and no one going to load the module you can simply:
echo ' blacklist my_proc_to_ban ' >> /etc/modprobe.d/my_proc_to_ban.conf
That will prevent your module to load on boot, but you still be able to load it if needed on some stage.
A way to be sure is to remove or move the module from /lib/modules
You may also use /etc/modprobe.d/blacklist.conf
On kernel command line you may add
Depending on which distribution you use : debian (and derivatives) may build a initrd which embeds modules that the script thinks are mandatory to boot the the system.
So you may have to rebuild the initrd image by running "update-initramfs -u".