Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> 關於 Linux

Ubuntu 設定 GRUB2 開機密碼保護:防止惡意修改啟動參數

編輯:關於 Linux

GRUB2 為預設開機載入程式,設定密碼可防止他人透過編輯啟動參數進入單用戶模式竄改系統。本文說明完整設定流程。

操作步驟

  1. 產生加密密碼
    grub-mkpasswd-pbkdf2
    # 輸入兩次密碼,輸出類似:
    # grub.pbkdf2.sha512.10000.BC4D0A450E86EE447561FC822C832xxxxxxxxxxxxx45572D3B4E40500CE
  2. 備份並編輯 00_header
    cp /etc/grub.d/00_header /etc/grub.d/00_header.bak
    vi /etc/grub.d/00_header
  3. 於檔案末尾加入
    ### Add those line to set GRUB2 password
    cat << EOF
    set superusers="leekwen"
    password_pbkdf2 leekwen grub.pbkdf2.sha512.10000.BC4D0A450E86EE447561FC822C832xxxxxxxxxxxxx45572D3B4E40500CE
    EOF
    ### Add end
  4. 更新 GRUB 設定
    update-grub
    務必執行此命令使設定生效。

驗證

重開機後,在 GRUB 選單按 e 會要求輸入用戶名(如 leekwen)與密碼,驗證通過才能編輯啟動項。

Copyright © Windows教程網 All Rights Reserved