修改qcow2镜像密码

修改qcow2镜像密码
1、安装libvirtd
# Ubuntu $ apt install -y qemu-kvm libvirt-bin bridge-utils virt-manager # CentOS

$ yum install -y qemu-kvm libvirt virt-install bridge-utils

 

2、启动libvirtd服务

systemctl start libvirtd

 

3、生成密码
[root@192 home]# openssl passwd -1 123456

$1$Nnv2QHyN$qu2bZyh7ef7xQJZnRtDSJ

 

4、加载qcow2文件
[root@192 system]# guestfish --rw -a CentOS-7-x86_64-GenericCloud-1805.qcow2 Welcome to guestfish, the guest filesystem shell for editing virtual machine filesystems and disk images. Type: ‘help’ for help on commands      ‘man’ to read the manual      ‘quit’ to quit the shell

><fs>

 

5、修改密码
><fs> run 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00 ><fs> list-filesystems /dev/sda1: xfs ><fs> mount /dev/sda1 / ><fs> vi /etc/shadow  #替代root的秘密,利用前面openssl生成的密码 ><fs> quit
posted @   leiuk  阅读(272)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
点击右上角即可分享
微信分享提示