修改Cloud image的密码的简单方法
2017-07-31 17:15
2471 查看
原文:
https://scottlinux.com/2017/05/08/set-password-or-ssh-key-for-centos-cloud-images/
CentOS为各种不同的云环境提供cloud images,比如OpenStack,RHV,AZure,或KVM. 一般来说,是通过cloud-init工具来修改用户密码或SSH keys. 但是那似乎不太方便。 下面是一种方便的方法。
官方的CentOS的cloud image的下载地址是:
http://cloud.centos.org/centos/7/images/
第一步,安装软件libguestfs-tools
第二步,设定一个固定密码
结束。
这一步也可以设一个随机密码:
这一步还可以是这样:安装或删除package,甚至同时设置自己的SSH key
[译者注]
以上的文章完结了。但在实际使用过程中,往往我们还希望能够ssh到这个cloud image的instance上。此时发现cloud image默认是不允许用root以及密码进行登录的。那么解决办法就是:
1. 编辑 /etc/ssh/sshd_config 文件,将其中的下面2句话释放出来:
(完)
https://scottlinux.com/2017/05/08/set-password-or-ssh-key-for-centos-cloud-images/
CentOS为各种不同的云环境提供cloud images,比如OpenStack,RHV,AZure,或KVM. 一般来说,是通过cloud-init工具来修改用户密码或SSH keys. 但是那似乎不太方便。 下面是一种方便的方法。
官方的CentOS的cloud image的下载地址是:
http://cloud.centos.org/centos/7/images/
第一步,安装软件libguestfs-tools
sudo yum install libguestfs-tools 或 sudo apt install libguestfs-tools 或 sudo dnf install libguestfs-tools
第二步,设定一个固定密码
sudo virt-customize -a CentOS-7-x86_64-GenericCloud-1703.qcow2 --root-password password:passw0rd
结束。
这一步也可以设一个随机密码:
sudo virt-customize -a CentOS-7-x86_64-GenericCloud-1703.qcow2 --root-password random [ 0.0] Examining the guest ... [ 11.2] Setting a random seed [ 11.2] Setting passwords virt-customize: Setting random password of root to 132Tfe6cfCCr8Pv8 [ 12.2] Finishing off
这一步还可以是这样:安装或删除package,甚至同时设置自己的SSH key
sudo virt-customize -a CentOS-7-x86_64-GenericCloud-1703.qcow2 --install epel-release --ssh-inject centos:string:"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKCqX6EZIrGHoGaMII4QAqr0QC72t+Kg/c5ZIRNTMb6Q+BwzejQgjhBTXeyPnp0rfE9XI4pTxkZqAUOGSK9Bfqg= smiller@bruckner"
[译者注]
以上的文章完结了。但在实际使用过程中,往往我们还希望能够ssh到这个cloud image的instance上。此时发现cloud image默认是不允许用root以及密码进行登录的。那么解决办法就是:
1. 编辑 /etc/ssh/sshd_config 文件,将其中的下面2句话释放出来:
PermitRootLogin yes PasswordAuthentication yes2. 重启sshd
(完)
相关文章推荐
- 一种简单的修改所有域内本地管理员密码,及加某个帐号至本地管理员组的方法
- mysql 5.7版本修改密码的简单方法
- Linux下刚安装完mysql修改密码的简单方法
- 修改MySQL的root密码的简单方法
- 在Linux下修改和重置root密码的方法(超简单)
- sql root账户密码忘记怎么办?最简单的sql语句修改方法
- Windows XP 用户密码简单修改方法
- WEb 修改AD域用户密码最简单直接的方法
- 一种简单的修改所有域内本地管理员密码,及加某个帐号至本地管理员组的方法
- linux忘记root密码最简单的修改方法
- 管理员 修改MySQL 5.7.9 新版本的root密码方法以及一些新变化整理
- MySQL——修改root密码的4种方法(以windows为例)
- sqlserver的sa账户的密码忘了(修改方法)
- Linux下批量修改服务器用户密码方法步骤
- jquery 弹出登陆框,简单易懂!修改密码效果代码
- 获取帐号密码的简单方法
- mysql修改密码的三方法和忘记root密码的解决方法
- MySQL修改root密码的多种方法
- 【转】修改Ubuntu系统的登陆信息的简单方法
- Thunderbird邮箱密码错误修改方法