CentOS 7 改 root 密碼

CentOS 6 之前都很簡單,只要在 grub 編輯 “-s” 然後既可以改。CentOS 7真的要做一下筆記了。

step 1 image
  1. 重新開機後在 boot grub 裡面選第一個然後按 ‘e’ 按鈕編輯(參考 step 1 image)
  2. 然後找到 ‘ro’ 改成 ‘rw init=/sysroot/bin/sh’ 按 Ctrl-x 離開(參考 step 2 image1 & 2)
  3. 改變 root 路徑,用 ‘chroot /sysroot’ 指令
  4. 然後改變密碼,用 ‘passwd root’ 指令
  5. 如果有啟用 selinux,用 ‘touch /.autorelabel’ 指令
  6. 然後離開並且重新開機,用 ‘exit’ 及 ‘reboot’ 指令
step 2 image1
step 2 image2

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.