zoukankan      html  css  js  c++  java
  • 修改openstack Centos镜像的默认用户的密码

    Ubuntu官方提供的OpenStack镜像是用Key来登录的,太麻烦,可以改成用密码来登录。

    修改image的工具叫:guestfish。

    yum install libguestfs-tools

    用它来打开一个镜像

    guestfish --rw -a trusty-server-cloudimg-amd64-disk1.img

    guestfish的命令行提示符是>。

    你需要先运行这个镜像

    run

    如果这一步报错:

    libguestfs: error: /usr/bin/supermin-helper exited with error status 1.
    To see full error messages you may need to enable debugging.
    See http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs
    则请退出guestfish,然后运行下面的命令。

    # update-guestfs-appliance 

    更新完后再重新进入镜像。

    列出所有的文件系统

    list-filesystems 
    /dev/sda1: ext4

    挂载到根目录

    mount /dev/sda1 /

    编辑文件/etc/cloud/cloud.cfg,因为我们要修改默认用户root的密码并且开启root的ssh登陆,很简单加入下面的内容就行了,上面两个是修改。

    disable_root: 0
    ssh_pwauth:   1
    
    chpasswd:
      list: |
          root:root
      expire: False

    退出后,把这个镜像加到OpenStack里就行了。

  • 相关阅读:
    Codeforces
    Codeforces
    Codeforces
    Codeforces
    Codeforces
    Codeforces
    Codeforces
    Codeforces
    洛谷
    GXU
  • 原文地址:https://www.cnblogs.com/wuhg/p/10445096.html
Copyright © 2011-2022 走看看