Add the user
sudo useradd -s /bin/bash -d /home/userubuntu/ -m -G sudo userubuntuCreate authorized_keys file and put you public ssh key
mkdir /home/userubuntu/.ssh/
chmod 0700 /home/userubuntu/.ssh/
sudo -- sh -c "echo 'put the ssh-rsa public key here' > /home/userubuntu/.ssh/authorized_keys"
sudo chown -R userubuntu:userubuntu /home/userubuntu/.ssh/Allow the user to use sudo without password, type sudo visudo and edit the file, adding userubuntu ALL=(ALL) NOPASSWD:ALL like this
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
dimitar ALL=(ALL) NOPASSWD:ALLAllow only public key access, no password allowed. sudo vim /etc/ssh/sshd_config
ChallengeResponseAuthentication no
PasswordAuthentication no
PermitRootLogin no
PubkeyAuthentication yes
UsePAM norestart the ssh service : sudo systemctl restart sshd