The `password` command needs to be used together with the `lock` command.
When the `lock` command is executed, it displays a password input interface, requiring the user to provide a password. If the user fails to provide the correct password, the execution result of the `lock` command is an error, and then subsequent commands cannot be executed.
You can place the `password` command before `title`, so that the entire menu will be protected. Unless you enter `p` as prompted on the screen and provide the correct password (which is equivalent to unlocking), all menu items cannot be changed. But at this time, the user can execute all the menu items in your existing menu. Unless you use `lock` to lock a certain menu, the user will not be able to execute the commands in the corresponding menu.
Note that it is more appropriate to place `lock` in the first statement after `title`, because only when the program executes to `lock` will it prevent the user from further execution. You lock all the menu items that need to be protected, that is, after each `title` line, a `lock` is needed, otherwise, the menu item is not protected and the user can execute it.
Please refer to the official manual of GNU GRUB legacy. What I said may not be accurate. Please refer to the official manual of GNU GRUB legacy.
[ Last edited by 不点 on 2008-8-10 at 10:00 AM ]
因为我们亲手创建,这个世界更加美丽。