当前位置:网站首页>KVM虚拟机救援模式修改root密码 —— 筑梦之路
KVM虚拟机救援模式修改root密码 —— 筑梦之路
2022-06-21 20:40:00 【筑梦之路】
KVM 虚拟机挂载iso镜像进入救援模式
操作步骤如下:
关闭虚拟机
虚拟机xml 添加cdrom配置
修改虚拟机xml boot启动项
虚拟机加载光盘镜像进入救援模式
修改系统密码文件,关机
修改xm文件boot启动项,开机
关闭虚拟机
virsh destroy guest-rhel7
编辑虚拟机文件
virsh edit guest-rhel7
添加cdrom镜像
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/kvm/iso/CentOS-7-x86_64-DVD-2009.iso'/>
<target dev='hda' bus='ide'/>
<readonly/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
修改虚拟机xml文件,将boot 改为光盘启动
<os>
<type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>
<boot dev='cdrom'/>
<bootmenu enable='yes'/>
</os>
开启虚拟机
virsh start guest-rhel7
查看vnc端口
virsh vncdisplay guest-rhel7
:0
虚拟机开机加载ISO光盘镜像




修改Root密码
编辑 /etc/shadow文件,删除第一个:和第二个:之间的整个字符串

编辑完成后,按以下顺序按以下键保存文件Esc -> : -> wq!

退出 chroot 控制台 ,systemctl poweroff 关闭计算机

修改虚拟机xml 文件中boot 启动项,修改为硬盘启动

虚拟机启动后,使用root账户登录系统,此时root密码为空,并通过执行 passwd 命令为 root 用户设置新密码。
边栏推荐
- flutter系列之:flutter中的IndexedStack
- 【深入理解TcaplusDB技术】TcaplusDB导入数据
- About Eureka starting successfully but accessing 404
- File i/o
- [in depth understanding of tcapulusdb technology] tcapulusdb construction data
- [deeply understand tcapulusdb technology] tmonitor system upgrade
- Introduction to class library, framework, module, component and other concepts
- PAML|计算dN/dS值的生信软件
- 分布式数据库使用逻辑卷管理存储之扩容
- Paml| Shengxin software for calculating dn/ds value
猜你喜欢

How to uninstall a package installed with the CONDA command

迅为iTOP-3568开发板安装 RKNN Toolkit Lite2

Thresholdtypes of opencvsharp threshold segmentation threshold function

Instadeep ltd:arthur flajolet | group based rapid reinforcement learning on a single machine

Sampler collection

Notes on topic brushing (16) -- binary tree: modification and construction

nuxt ssr打包和部署

Introduction to software architecture

Nacos installation guide

Apache ShardingSphere 5.1.2 发布|全新驱动 API + 云原生部署,打造高性能数据网关
随机推荐
Anaconda add channels
Install RkNN toolkit Lite2 for itop-3568 development board
PAML|计算dN/dS值的生信软件
celery+rabbit分布式任务处理
【深入理解TcaplusDB技術】TcaplusDB構造數據
File i/o
班主任让开股票账户,在启牛开户安全吗?
力扣:零钱兑换
利用while循环,分别计算1-100中奇数的和、偶数的和【方法二】
es7创建索引模板
关于lg(n!)的渐进紧确界
MitoZ|Multi-Kmer mode
Technology sharing | mysql:caching_ sha2_ Password quick Q & A
Dategridview first column sort
vb屏幕分辨率设置和获取_hawkol_新浪博客
GDB调试实战(10)多线程调试
Beijing accelerates ecological construction, Medtronic Internet and Moore thread complete product compatibility and mutual certification
项目流程管理工具OmniPlan Pro 4
mafft|多序列比对工具
技术分享 | MySQL中一个聚类增量统计 SQL 的需求