1

is there any way to disallow changing init parameter on boot time? I want to prevent situation when someone reboot my server, edit grub entry and get access without password. Maybe some kernel parameters I can change while kernel compile?

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
KaP
  • 452
  • 1
  • 4
  • 17

1 Answers1

2

If someone has physical access to your computer, they can boot from a USB key, or take out the hard drive and plug it into another computer. To prevent someone from changing boot parameters, put the computer in a locked case or locked room.

If the computer is in a locked case but its keyboard is accessible to untrusted people, then you need a software means to prevent booting with alternate parameters. This is the job of the bootloader, not the job of the kernel (the kernel isn't the software that's prompting you for parameters at boot time: it isn't even loaded into memory at that point). Be sure to forbid booting from any exposed external ports (e.g. USB, network) in the BIOS, and to set a password to access the BIOS configuration interface.

If your bootloader is Grub, activate its lockdown features: add a superusers setting to your grub.cfg, as well as password_pbkdf2 to set a password that allows accessing the command line. Be sure to add the --unrestricted option to your normal menu entry as well. See the manual for details and an example.