On the remote machine:
sudo su -
useradd <username> -m -s /bin/bash
echo '<username> ALL=(ALL:ALL) NOPASSWD:ALL' >> /etc/sudoers
mkdir -p /home/<username>/.ssh
touch /home/<username>/.ssh/authorized_keys
chown -R <username>:<username> /home/<username>/.ssh
chmod 700 /home/<username>/.ssh
chmod 600 /home/<username>/.ssh/authorized_keys
On the local machine:
ssh-keygen -b 4096 -f /path/to/privatekey -t rsa -N '' -o -a 500 -C "some description"
cat /path/to/publickey | ssh root@<ipaddress> "sudo tee -a /path/to/authorized_keys"