ubuntu重置密码忘记
If you’ve ever forgotten your password, you aren’t alone… it’s probably one of the most common tech support problems I’ve encountered over the years. Luckily if you are using Ubuntu they made it incredibly easy to reset your password.
如果您忘记了密码,那么并不孤单……它可能是我多年来遇到的最常见的技术支持问题之一。 幸运的是,如果您使用的是Ubuntu,则可以轻松地重置密码。
All it takes is adjusting the boot parameters slightly and typing a command or two, but we’ll walk you through it.
所需要做的只是稍微调整启动参数并输入一个或两个命令,但是我们将逐步指导您。
Reset Your Ubuntu Password
重置您的Ubuntu密码
Reboot your computer, and then as soon as you see the GRUB Loading screen, make sure to hit the ESC key so that you can get to the menu.
重新启动计算机,然后在看到GRUB Loading屏幕时,请确保按ESC键,以便进入菜单。
Root Shell – Easy Method
根壳–简单方法
If you have the option, you can choose the “recovery mode” item on the menu, usually found right below your default kernel option.
如果您有此选项,则可以在菜单上选择“恢复模式”,该选项通常位于默认内核选项的正下方。
Then choose “Drop to root shell prompt” from this menu.
然后从此菜单中选择“ Drop to root shell提示”。
This should give you a root shell prompt.
这应该给您一个root shell提示。
Alternate Root Shell Method
备用根壳法
If you don’t have the recovery mode option, this is the alternate way to manually edit the grub options to allow for a root shell.
如果没有恢复模式选项,则这是手动编辑grub选项以允许使用root shell的另一种方法。
First you’ll want to make sure to choose the regular boot kernel that you use (typically just the default one), and then use the “e” key to choose to edit that boot option.
首先,您需要确保选择要使用的常规启动内核(通常只是默认的启动内核),然后使用“ e”键选择编辑该启动选项。
Now just hit the down arrow key over to the “kernel” option, and then use the “e” key to switch to edit mode for the kernel option.
现在,只需将向下箭头键移至“内核”选项,然后使用“ e”键切换到内核选项的编辑模式。
You’ll first be presented with a screen that looks very similar to this one:
首先,您将看到一个类似于此屏幕的屏幕:
You’ll want to remove the “ro quiet splash” part with the backspace key, and then add this onto the end:
您将需要使用Backspace键删除“ ro quiet splash”部分,然后将其添加到末尾:
rw init=/bin/bash
rw init = / bin / bash
Once you hit enter after adjusting the kernel line, you’ll need to use the B key to choose to boot with that option.
调整内核行后按Enter键,您将需要使用B键选择使用该选项进行引导。
At this point the system should boot up very quickly to a command prompt.
此时,系统应非常快速地启动到命令提示符。
Changing the Actual Password
修改实际密码
You can use the following command to reset your password:
您可以使用以下命令来重置密码:
passwd <username>
passwd <用户名>
For example my username being geek I used this command:
例如,我的用户名是极客,我使用了以下命令:
passwd geek
密码怪胎
After changing your password, use the following commands to reboot your system. (The sync command makes sure to write out data to the disk before rebooting)
更改密码后,使用以下命令重新引导系统。 (sync命令确保在重启之前将数据写出到磁盘上)
sync reboot –f
同步重启–f
I found that the –f parameter was necessary to get the reboot command to work for some reason. You could always hardware reset instead, but make sure to use the sync command first.
我发现–f参数是使出于某种原因重新启动命令运行所必需的。 您总是可以通过硬件重置来代替,但是请确保首先使用sync命令。
And now you should be able to login without any issues.
现在,您应该可以顺利登录了。
翻译自: https://www.howtogeek.com/howto/linux/reset-your-forgotten-ubuntu-password-in-2-minutes-or-less/
ubuntu重置密码忘记