虚拟机重置密码 Posted on 2021-10-26 00:00:00 2021-10-26 00:00:00 by Author 摘要 长时间不用在本地安装的虚拟机就忘记了登录密码,如何找回密码尼?按照以下步骤就能重置密码,亲测有效,你学会了吗? # virtualBox虚拟机忘记密码的解决办法 ## 1.Centos Linux重置密码 1. **启动系统,系统会出现引导程序,我们需要在引导页面选择不同的操作,以便让引导程序暂停,出现下方暂停后的界面,可以按 ↑或↓ 选操作,此时,按下键盘的 e,进入编辑模式** ![](http://e-blog.oss-cn-shanghai.aliyuncs.com/resources/user/getopsite/article/2021-10-26/2909544755792278938.png) 2. **将光标移动到 UTF-8后,打一空格,输入 “init=/bin/sh”,注意,有的虚拟机因为屏幕小,会自动添加 \ 换行。** ![](http://e-blog.oss-cn-shanghai.aliyuncs.com/resources/user/getopsite/article/2021-10-26/-934870629700090623.png) 3. **按下 Ctrl+x键引导启动,进入该页面后需要输入一些命令** ![](http://e-blog.oss-cn-shanghai.aliyuncs.com/resources/user/getopsite/article/2021-10-26/-1082937375181615751.png) 4. **依次输入以下命令:** - mount -o remount,rw / (注意rw后有空格) - passwd root (root为修改的用户名,自行修改)输入两次新密码(密码是密文) - touch /.autorelabel (touch后有一空格) - exec /sbin/init (exec后有一空格) 5. **此时重新启动系统,输入账户密码即可。** ## 2.virtualbox ubuntun重置密码 1. **启动系统时进入GUN GRUB界面(长按shift/按下ESC/按下e键)** 2. **选择进入Ubuntu高级选项。** ![](http://e-blog.oss-cn-shanghai.aliyuncs.com/resources/user/getopsite/article/2021-10-26/3297582911678291848.png) 3. **选择recovery mode,按e** ![](http://e-blog.oss-cn-shanghai.aliyuncs.com/resources/user/getopsite/article/2021-10-26/-3597164948406822504.png) 4. **将光标定位到linux一行,出现recovery nomodeset就删除,没有就不用管。** ![](http://e-blog.oss-cn-shanghai.aliyuncs.com/resources/user/getopsite/article/2021-10-26/2860397862536828423.png) 5. **在linux行末输入quiet splash rw init=/bin/bash,再按下Fn+F10(F10也行)** 6. **在新出现的页面中输入(注意区分大小写)passwd+“你的用户名”** 7. **接下来输入新密码,再重新输一遍。 这里注意密码是看不见的,输好后回车就行。** 8. **工具栏选重启,再登录就行。**
{{ item.content }}
{{ child.content }}