标签:sysimage root mnt 密码 设置 Linux 忘记 ROOT 硬盘
忘记root密码解决思路:用光盘启动 重新设置密码
将光盘 设置为第一启动 保存退出
进入救援模式 用光盘启动 设置root密码
主板上有个bios芯片,不但可以自检程序用于引导之外,还可以设置(一般电脑的话开机按 F2、F1或者其他键)虚拟机上就是打开电源时进入固件
![Linux ROOT密码忘记解决方法 root口令忘记解决方法_ci](/i/li/?n=2&i=images/202308/a439b3d5723f3381ac157660cb64f0ad2c74e6.png?,size_14,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=,x-oss-process=image/resize,m_fixed,w_1184)
然后开机 找到Boot(启动)
里面是启动顺序,谁排在上面说明第一引导是谁先找谁
Hard Drive (硬盘驱动器)
CD-ROM Drive (光盘)
Removable Dvices 移动设备(U盘之类的)
Network boot from Intel E1000(网络)
系统启动过程:先去找硬盘没找到(MBR坏掉了不能把引导权交给他)接下来找光盘没有的话,那就去找网络
![Linux ROOT密码忘记解决方法 root口令忘记解决方法_保存更改_02](/i/li/?n=2&i=images/202308/54df85809f1da981a68790ffa5d3ec293cdb13.png?,size_14,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=,x-oss-process=image/resize,m_fixed,w_1184)
然后右移找到Exit
Exit Saving Changes 退出保存更改 (选这个)
Exit Discarding Changes 退出丢弃的变化
Load Setup Defaults 负载设置默认值
Discard Changes 丢弃的变化
Save Changes 保存更改
![Linux ROOT密码忘记解决方法 root口令忘记解决方法_ci_03](/i/li/?n=2&i=images/202308/33a4a9c425f4ce76fc43463bc843572917006d.png?,size_14,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=,x-oss-process=image/resize,m_fixed,w_1184)
Install CentOS 7 安装CentOs 7系统
Test this media & install CentOs 7 测试 并安装CentOs 7
Troubleshoot ing 故障排除 修复
![Linux ROOT密码忘记解决方法 root口令忘记解决方法_保存更改_04](/i/li/?n=2&i=images/202308/44c484a5843e71f4b9806335a9baad98d6ba4f.png?,size_14,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=,x-oss-process=image/resize,m_fixed,w_1184)
Rescue a CentOS system 拯救一个CentOS系统(选这个)
Run a memory test 运行内存测试
Boot from local drive 从本地驱动器启动
Return to main menu 返回主菜单
![Linux ROOT密码忘记解决方法 root口令忘记解决方法_CentOS_05](/i/li/?n=2&i=images/202308/977402620d5d312cb2e4395a320a54740a7e1a.png?,size_14,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=,x-oss-process=image/resize,m_fixed,w_1184)
1) Continue 继续(选这个)
2) Read-only mount 进入只读 挂载
3) Skip to shell 跳过shell
4) Quit (Reboog) 退出
Please make a selection from the above:请从以上选择:
![Linux ROOT密码忘记解决方法 root口令忘记解决方法_保存更改_06](/i/li/?n=2&i=images/202308/f295564687906d9de10257949cf0d850da92b1.png?,size_14,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=,x-oss-process=image/resize,m_fixed,w_1184)
Rescue Mount 救援 挂载
Your system has been mounted under /mnt/sysimage.
你的系统已经安装在/mnt/sysimage下。
lf you would like to make your system the root environment, run the cinnabd:
如果你想让你的系统成为根环境,运行cinnabd:
chroot /mnt/sysimage
大概意思是:他帮我们去找一下我的硬盘上有没有安装linux的一个分区
你的系统已经找到了 并且已经挂载到/mnt/sysimage目录下。
(那么已经说明他已经找到了原来的SDA的分区表,分区表没有破坏,看到这一现象的时候就说明无需提前备份MBR)
如果你想使用这个目录里面的东西(就是原来硬盘的根分区)你想再把这个目录下的东西设置原来的根分区 敲这个命令chroot /mnt/sysimage
chroot(切换跟) 做完这个命令后就相当于把这个目录设为一个根(我们常说的虚根)
这样的话就和以前的操作习惯一样了
![Linux ROOT密码忘记解决方法 root口令忘记解决方法_CentOS_07](/i/li/?n=2&i=images/202308/475400511cba242c1bd88487533cea2ffaa4ac.png?,size_14,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=,x-oss-process=image/resize,m_fixed,w_1184)
我们现在所在的位置是在光盘的根 需要切换为sda的根
chroot /mnt/sysimage
现在就是在硬盘的根分区下敲命令 设置密码就是给root设置密码 就会保存到当前磁盘上(当前硬盘就是硬盘)
敲passwd 重新设置密码即可
然后退出 把光盘引导改为硬盘引导 就可以了
标签:sysimage,
root,
mnt,
密码,
设置,
Linux,
忘记,
ROOT,
硬盘
From: https://blog.51cto.com/u_15971294/7057433