When creating a VM with uvt-kvm tool, the VM does not allow password authentication over SSH.
$ uvt-kvm create test01
$ uvt-kvm ip test01
192.168.122.22
$ ssh -l root 192.168.122.22
Please login as the user "ubuntu" rather than the user "root".
|
Here is how to enable password authentication with root user.
Prepare cloud-init file..
$ cat user-data
#cloud-config
ssh_pwauth: yes
chpasswd:
list: |
ubuntu:hello
root:hello
expire: False
runcmd:
- sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
- systemctl restart sshd
|
create a VM
$ uvt-kvm create --user-data=./user-data test02
$ ssh -l root `uvt-kvm ip test02`
root@192.168.122.32's password:
Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-89-generic x86_64)
root@ubuntu:~#
|
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.