關於 PHP, Linux, Open Source 及個人生活記載的網誌。
RSS icon
  • 恢復 FreeBSD 的 root 密碼

    Posted on June 13th, 2007 Sam Tang 1 comment

    當在 FreeBSD 忘記了 root 密碼時,可以在開機時進入 single user mode 及重新設定密碼,方法如下:

    1. 重新開啟 FreeBSD 主機。

    2. 在 "Welcome to FreeBSD!" 開啟選單中按 "4" 選擇 "Boot FreeBSD in single user mode"。

    3. 然後會看到 "When prompted Enter full pathname of shell or RETURN for /bin/sh:",直接按 Enter。

    4. 這時便會直接進入 single user mode,輸入以下指令重新掛載根目錄 "/" 為可讀寫:

    # mount -u /
    # mount -a

    5. 用 passwd 重新設定 root 密碼:

    # passwd

    6. 最後重新啟動即可:

    # sync;sync;sync;reboot


     

    One response to “恢復 FreeBSD 的 root 密碼”

    1. 太棒囉!
      趕快記下來!
      太有用了!

    Leave a reply

    *
    To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
    Click to hear an audio file of the anti-spam word