Linux ubuntu忘记root密码解决方法

方法一:
只是忘记root密码,用户密码没有忘记:
在终端输入: sudo passwd root
重新设置一下就可以了

方法二:
启动系统,在以下界面通过上下键移动,选择Ubuntu高级选项(或者有的版本显示的是Advanced options for Ubuntu),然后按’Enter’键
Linux ubuntu忘记root密码解决方法
进入这个界面,选中Ubuntu,with Linux xxxxxxxxxx-generic (recovery mode) ,选择最新版本按’e’键进入下一界面
Linux ubuntu忘记root密码解决方法

进入这个界面,找到大概红框位置的 ro recovery nomodeset 删掉并改写成 quiet splash rw init=/bin/bash
Linux ubuntu忘记root密码解决方法

按’F10’键,数秒后,进入界面如下:
Linux ubuntu忘记root密码解决方法

输入命令passwd,如下
Linux ubuntu忘记root密码解决方法

按下"Enter"键,界面如下:
Linux ubuntu忘记root密码解决方法

输入一次密码后,按"Enter"键盘,按下回车,再次输入密码,输完2次密码,按下"Enter"键,界面如下:
Linux ubuntu忘记root密码解决方法
说明密码输入成功,重启电脑即可