---
title: "忘记Ubuntu root密码的解决办法 "
author: "hipeace87"
date: "2010-01-20T09:39:57Z"
tags: []
categories: ["操作系统"]
slug: "ubuntu-root"
draft: false
lastmod: "2010-01-20T16:31:21Z"
id: 575276
url: "https://hipeace87.iteye.com/blog/575276"
---

1\. 重启ubuntu,按ESC键进入GRUB引导界面  
2\. 选中recovery mode安全模式并按”e”进入编辑状态  
3\. 在kernel参数最后加上“init=/bin/bash”，对于Ubuntu，还要将”splash”删掉，要不splash接管了引导流程后还是会流向GDM。按回车保存，按”b”引导系统。

最后编辑完应该如下所示:

         kernel  /boot/vmlinuz-2.6.17-11-generic root=/dev/hda3 ro quiet init=/bin/bash

4\. 启动后会进入一个管理员shell的console下,执行下面的命令

// 根分区的挂载模式默认是只读，要将其改为可写

```
mount -no remount,rw /
```

// 修改密码,{user}指代你要修改密码的用户名

```
passwd {user}
```

// 同步,修改根分区回到只读状态，重新启动

```
mount -no remount,ro /
reboot
```