Setting the root password on Ubuntu for the first time

I tried to copy a folder from a remote machine:

acm@acm-docker2:/$ sudo rsync -avz root@ /opt/
The authenticity of host ‘ (’ can’t be established.
ECDSA key fingerprint is 38:0c:ee:74:49:65:7d:74:35:b3:a0:76:13:db:5e:74.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘’ (ECDSA) to the list of known hosts.
root@’s password:
Permission denied, please try again.

..and failed because the root account is locked by default so I have to set a password first:

sudo passwd root

I ran the command again and this time it works.