以ubuntu为例
-
进入recovery mode
进入recovery mode -
选择Drop to root shell prompt ,也就是获取root权限。
Drop to root shell prompt -
在下面的# 后面敲入 cat /etc/shadow 查看用户名(如果连用户名都忘记的话)
cat /etc/shadow 查看用户名 -
敲入:passwd "yulongsheng" 之后再敲两次密码就可以了。
修改密码 - ctrl + D 退出terminal
- 按ctrl+alt+del重启