有一个想法是通过设置密码完全禁用命令行选项(或至少是编辑菜单)来删除在 GRUB 中编辑 cmdline 的能力。我看到了这样的选项(添加到 00_header 的内容):
set superusers="root"
password_pbkdf2 root grub.pbkdf2.sha512.password
export superusers
像这样:
set superusers="root"
password root rootpassword
export superusers
两者都不起作用:
root@linuxlite6:/ # update-grub
/etc/grub.d/00_header: 451: password: command not found
root@linuxlite6:/ # update-grub
/etc/grub.d/00_header: 451: password_pbkdf2: command not found
是的,不要谈论 GRUB_TIMEOUT="0" 和 GRUB_HIDDEN=true。他们只是删除了选择菜单,但这不是我需要的。我只需要禁用/限制对 GRUB 命令行的访问(包括编辑引导选项)
不要破坏 00_header 创建新文件 00_passwords
这些不是直接放置在鹅耳枥中。他们应该输出插入文本。
并滚动浏览其余文件,查看是否以另一种方式覆盖了超级用户