Permission denied when SSHing into Ubuntu Virtual Machine

I have a VirtualBox machine running Ubuntu 18.04.2. I have installed OpenSSH on it.

In the Settings of the Virtual Machine I have set up this port forwarding rule:

Protocol: TCP

Host IP: 127.0.0.1

Host Port: 2222

Guest IP: 10.0.2.15

Guest Port: 22

The SSH command I run in my local terminal is:

ssh myname@127.0.0.1 -p2222 

It then asks me for the password, which I enter, and I get this error:

Permission denied, please try again.

The username and password are the ones I created when setting up Ubuntu.