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

Linux 忘記 root 密碼?兩種恢復模式完整教學

編輯:關於 Linux

Linux root 密碼遺忘雖不常見,但長時間未登入系統時容易發生。root 為最高權限帳號,密碼遺忘將造成諸多不便。本文介紹兩種恢復 root 密碼的實用方法。

方法一:單用戶模式恢復

  1. 重啟系統,在 GRUB 選單出現時按 e 進入編輯模式。
  2. 再次按 e 編輯核心啟動參數。
  3. 找到含 kernel 關鍵字的那一行,再按 e。
  4. 在 quiet 後加空格輸入 single,進入單用戶模式。
  5. 按 Enter 返回上層選單,按 b 啟動。
  6. 系統啟動後進入根目錄提示符,執行 passwd 修改 root 密碼,提示 update successfully 即成功。
  7. 輸入 reboot 重啟,使用新密碼登入。

方法二:光碟救援模式恢復

  1. 放入 Linux 安裝光碟啟動,進入啟動選單。
  2. 輸入 linux rescue 進入救援模式。
  3. 選擇語言(預設按 Enter)、鍵盤模式。

  4. 網路設定選擇 No(用 Tab 切換)。
  5. 直接按 Enter 讓系統自動偵測並掛載現有系統。
  6. 確認掛載資訊,選 OK。
  7. 在命令列依序執行 chroot /mnt/sysimage、passwd 修改密碼、exit 離開 chroot、reboot 重啟(重啟前取出光碟)。

注意:此教學以 Red Hat 5.0 為例,但步驟適用於大多數 Linux 發行版,僅細節略有差異。

Copyright © Windows教程網 All Rights Reserved