0

I am trying to get ssh working in multipass, so I can ssh user@ip -i key.pub not using multipass shell.

I am using the following cloud-init:

ssh-keygen -C vmadmin -f user_key

users:
  - default
  - name: vmadmin
    sudo:  ALL=(ALL) NOPASSWD:ALL
    ssh_authorized_keys:
      - ssh-rsa xxx vmadmin

multipass launch -n testvm --cloud-init cloud-init.yaml
chmod 400 user_key.pub

Why is it asking for password, when ssh into the multipass instance?:

sudo ssh vmadmin@192.168.64.2 -i user_key.pub
Password:
sudo: a password is required

Also tried adding password to cloud-init.yaml

passwd: 123

But unable to login?

Chris G.
  • 207
  • 1
  • 9

1 Answers1

0

My problem was simply that I used public key:

sudo ssh vmadmin@192.168.64.2 -i user_key.pub

It should of course be used with private key:

sudo ssh vmadmin@192.168.64.2 -i user_key
Chris G.
  • 207
  • 1
  • 9