openstack创建镜像初始化root密码

本文介绍了如何在OpenStack中创建虚拟机时初始化root密码。通过修改控制节点的nova配置文件,设置`inject_password=true`,并重启服务。接着在创建虚拟机时注入设置密码的脚本。Ubuntu系统通常能立即生效,而CentOS可能需要等待几分钟。成功与否的判断依据是登录提示信息。确保使用带cloud-init的镜像以实现密码注入。
摘要由CSDN通过智能技术生成

概要:

在新建虚拟机的过程中,可以对root密码进行初始化。这样可以保障虚拟机的安全,同时也可以给用户自定义root密码的机会。


步骤:

修改控制节点的nova配置项:

 

首先修改nova的配置文件。文件位置 /etc/nova/nova.conf

inject_password改为True

 

[libvirt]

 

# There is no agent needed within the image to do this. If *libguestfs* is

# available on the host, it will be used. Otherwise *nbd* is used. Thefile

# system of the image will be mounted and the admin password, which isprovided

# in the REST API call will be injected as password for the root user. Ifno

# root user is available, the instance won't be launched and an error isthrown.

# Be aware that the injection is *not* possible when the instance getslaunched

# from a volume.

#

# Possible values:

#

# * True: Allows the injec

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值