How to fix «Please login as the user "ubuntu" rather than the user "root"»?

sudo su
mv /root/.ssh/authorized_keys /home/ubuntu
chmod 777 /home/ubuntu/authorized_keys 

Remove the string:

no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo 'Please login as the user \"ubuntu\" rather than the user \"root\".\';echo;sleep 10"
chmod 600 /home/ubuntu/authorized_keys
mv /home/ubuntu/authorized_keys /root/.ssh

See also:

A one-liner solution:

sudo sed -i $'s|no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo \'Please login as the user \\\\"ubuntu\\\\" rather than the user \\\\"root\\\\".\';echo;sleep 10\" ||g' /root/.ssh/authorized_keys