文档:Changing and resetting the root password
root用户更改 root 密码只需要使用 passwd 命令
- # passwd
- Changing password for user root.
- New password:
- BAD PASSWORD: The password is shorter than 8 characters
- Retype new password:
- passwd: all authentication tokens updated successfully.
非 root 用户要更改 root 密码,必须有 sudo 特权
- $ sudo passwd
- [sudo] password for czy:
- Changing password for user root.
- New password:
如果没有 sudo 特权,可以在引导时通过切换到专门的 chroot 环境来重置 root 密码。
在 GRUB 2 引导屏幕上