Login as root account and create new deploy user
sudo adduser deploy
Enter password and other information.
https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-14-04
sudo gpasswd -a deploy sudo
These commands are run on your local machine
ssh-keygen
Finish your creating public key process. Normally it will be located at: ~/.ssh/id_rsa.pub
cat ~/.ssh/id_rsa.pub
It will show somethings like below id_rsa.pub contents ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDBGTO0tsVejssuaYR5R3Y/i73SppJAhme1dH7W2c47d4gOqB4izP0+fRLfvbz/tnXFz4iOP/H6eCV05hqUhF+KYRxt9Y8tVMrpDZR2l75o6+xSbUOMu6xN+uVF0T9XzKcxmzTmnV7Na5up3QM3DoSRYX/EP3utr2+zAqpJIfKPLdA74w7g56oYWI9blpnpzxkEd3edVJOivUkpZ4JoenWManvIaSdMTJXMy3MtlQhva+j9CgguyVbUkdzK9KKEuah+pFZvaugtebsU+bllPTB0nlXGIJk98Ie9ZtxuY3nCKneB+KjKiXrAvXUPCI9mWkYS/1rggpFmu3HbXBnWSUdf [email protected]
Add Public Key to New Remote User To enable the use of SSH key to authenticate as the new remote user, you must add the public key to a special file in the user's home directory.
Now you're login as root. Switch to deploy user
su - deploy
mkdir .ssh
chmod 700 .ssh
nano .ssh/authorized_keys
Paste the content of your public key here then save it.
chmod 600 .ssh/authorized_keys
Then use this tutorial to setup deployment