恢復 FreeBSD 的 root 密碼

恢復 FreeBSD 的 root 密碼

 

 

當在 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

 如果出現無法mount的情況的話, permisson deny的話, 則可以使用 -f 命令進行mount;

 

# mount -a -f

 

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

# passwd

 

6. 最後重新啟動即可:

# sync; init 6

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章