# @yrsamrith
# JUST A NOTE.
# connect to droplet with SSH
ssh root@SERVER_IP
# *** Using SSH ***
# generate ssh keys (private and public) for local machine
ssh-keygen
# copy local machine public key
cat ~/.ssh/id_rsa.pub | pbcopy
# paste public key in remote machine
mkdir ~/.ssh
chmod 700 ~/.ssh
vim ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
# *** AVOIDING USING ROOT ***
# create new user
adduser sam
# To enable 'sam' to use sudo command, add to sudo group.
# -a : append or add
# -G : group
usermod -aG sudo sam
# 'su -' vs 'su'?
su - sam
# *** DISABLE PASSWORD AUTHENTICATION - USE SSH ONLY ***
sudo vim /etc/ssh/sshd_config
# Find 'PasswordAuthentication no'
# Look out for firewall
sudo ufw app list
sudo ufw status