26
How-to-use guide for SSH
If you want to watch the video version of this, here the link (https://youtu.be/lWWlEDRO2uo).
SSH Authentication Methods
- Password [Using your server's user's password]
- Public/Private Key Pair

Don't use root to login. Instead create a new user
Create a new user
adduser chloe[Can be any name]

Now add chloe to sudo group
sudo usermod -aG sudo chloe.

Since you created a new user, add the public key to that user .ssh folder. It's usually located at /home/chloe. Create a new .ssh folder and create authorized_keys if not exist and paste public key inside.

# Login into remote server and navigate to /home/chloe
# Create a new .ssh folder
sudo mkdir /home/chloe/.ssh
# Create file 'authorized_keys'
# Paste client public key inside
# Save it
sudo nano authorized_keys
Next, change the ownership of the folder to chloe.
sudo chown -R chloe:chloe /home/chloe
chown - change ownership
R - Everything
chloe:chloe - user:group
/home/chloe - folder path
Now, on client side, if you're using new public/private key pair then you have to add them.
ssh-add /path/to/privatekey [eg. ~/.ssh/id_rso_new]
[optional]There a possibility that ssh agent inactive. Active by run
eval `ssh-agent -s`
That all. Hope the steps simple enough to understand. Peace :)