Log in with ssh root@public-ip
Setup default editor
select-editor
Add a user, disable password & skip questions
adduser --disabled-password --gecos "" deploy
Add the user to the SUDOERS list with usermod
(or edit sudoer file with visudo
)
usermod -aG sudo deploy
Change the default SSH port and disallow root acces. vim /etc/ssh/sshd_config
# What ports, IPs and protocols we listen for
Port 16888
...
PermitRootLogin no
Logout and reboot your linode via linode web interface. Don't attempt to restart SSHD while connected. :)
Test the new settings - Log back in with ssh deploy@your_ip -p 16888
and log out again
Run visudo
and add %deploy ALL=(ALL) NOPASSWD: ALL
Create your authorized keys file
mkdir ~/.ssh
touch ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
Logout and upload your public key
cat ~/.ssh/id_rsa.pub | ssh deploy@public-ip -p 16888 'cat >> .ssh/authorized_keys'