Login and password for multipass instance

I am new to ubunto and want to run it in a VM so have installed multipass successfully and have an ubunto VM running in Hyper V. Connecting to the VM I am asked for a login and password is ther a default? or can I set them up from the multipass command line? I can' find any information in the documentation.

I have also tried using shell on a named running instance but connection failed with message "ssh connection failed: 'Failed to resolve hostname primary.mshome.net (No such host is known.)" I then tried creating an instance with just "multipass shell" command. which created a running primary with same result.

Any suggestions welcome

5 Answers

This might be a bit late but you can login to the instance from multipass without being asked for username and password. From there, you can set the password so that you can login using Hyper V.

First find the name of your instance

multipass list

then login to the instance in multipass

multipass shell <instance name>

Next you can set your password for the default ubuntu user

sudo passwd ubuntu

Now when you try to login using hyper v, just use ubuntu as the username and whatever password you set as the password.

TLDR

If somehow multipass shell doesn't work, you can connect it via ssh.

ssh ubuntu@vm-ip-address -i /var/snap/multipass/common/data/multipassd/ssh-keys/id_rsa

Multipass instance, by default doesn't have usable password.

$ passwd --status ubuntu
ubuntu L 04/03/2021 0 99999 7 -1

The L means Locked password.

This is on purpose

If you somehow lose access to the vm (e.g messing up with the network configuration, it happens to me :D).

You can login using the default ssh private key. You can find the private key at:

/var/snap/multipass/common/data/multipassd/ssh-keys/id_rsa

If you are installing it via snap.

You can also find it using locate.

$ locate id_rsa | grep multipass

and connect to the vm using ssh:

ssh ubuntu@vm-ip-address -i /var/snap/multipass/common/data/multipassd/ssh-keys/id_rsa

You may want to change the ownership of the ssh key to your user account. Mine currently set to root.


To find the vm ip address, it depends on the backend. Mine is using libvirt.

virsh net-dhcp-leases default

In multipass instance, set a password to ubuntu user.

sudo passwd ubuntu

For the shell connection problem, I recommend to you check the host.ics file in windows (C:\WINDOWS\System32\drivers\etc\hosts.ics). If you find duplicate entries there, delete the last ones and try connect again. Usually this solve the problem and you see the IP for the instance is showed again using the next command:

multipass list

About the ubuntu password, I think via ssh any password is required but via "direct access" using Hyper-V is requested as you say. Probably not possible login using a password because default ubuntu password is configured as "--disabled".

From command line

### to find the instance name
c:\ multipass list
### to change the root password
c:\ multipass shell <instance name> passwd

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like