2008年12月13日 星期六

Debian 的單人模式修改密碼

原文: http://www.study-area.org/tips/news.htm

"小州" 撰寫於郵件 news:47dT0d$5KD@bbs.sayya.org...
> ※ 引述《deca@deca0206.adsldns.org (deca)》之銘言:
> > 請問各位大大
> > 突然想到看過文章說如果忘記root的密碼則進入單人模式再改root密碼即可
> > 找了文章後也知道grub要如何進入單人模式
> > 我嘗試在kernel~~這行最後加上 1(或s或-s或single)來進入單人模式
> > 接著開機程序跑到一半出現兩行
> > Give root password for maintenance
> > (or type Control-D for normal startup):
> > 似乎只得輸入root的密碼才行
> > 但是假設情況下我是忘記root密碼的
> > 我是哪一步做錯了嗎﹖
> > 請教各位前輩
> > 系統是debian testing and grub is the boot loader
>
> 因為 debian 的 /etc/inittab 檔案還有其他設定。
>
> 你可以在你剛剛進入 grub 編輯畫面輸入 single 後面再補上 init
> 指定為 /bin/sh,也就是:
>
> signal init=/bin/bash
>
> 最後開機到系統後,要先打 mount -o remount,rw / 讓 / 變成 rw,
> 然後執行 passwd root 改 root 密碼,重新開機時要執行
> mount -o remount,ro / 讓 / 成為 read-only,這樣子就可以了。
>
> 只是,passwd 程式是在 /usr/bin 目錄,若是你當初分割時 /usr
> 是獨立一個分割區的話,您需要在 mount -o remount,ro / 後,
> 手動打 mount /usr 把該分割區掛上後再進行下面動作。
>

沒有留言: