CentOS 7 如何重設 root 密碼?
在開機過程進入 grub 選單的時候,按 e 編輯開機選項

然後在 linux16 那一行找「ro」

把「ro」替換成下列指令「rw init=/sysroot/bin/sh」

然後按 Ctrl + X 離開,準備進入單人模式開機 (single user mode)

chroot 到系統內部
# chroot /sysroot
重設密碼
# passwd
如果有啟用 SELINUX 請記得 Auto Relabel
# touch /.autorelabel
離開 chroot
# exit
重新開機
# reboot
這樣 root 密碼就改好了