SSH
Generate a new SSH key
ssh-keygen
Upload public key
use scp to copy the public key to a remote machine.
scp C:/Users/USER/.ssh/id_rsa.pub ubuntu@192.168.2.3:~/id_rsa.pub
Specify port
scp -P 2222 C:/Users/USER/.ssh/id_rsa.pub ubuntu@192.168.2.3:~/id_rsa.pub
Log in to your Linux server using your username and password
ssh ubuntu@192.168.2.3
then
cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
Set private key permission
Windows
Remove all except for the key's user.
Linux
chmod 600 ~/.ssh/id_rsa
Specify private key
ssh -i "C:\Users\USER\.ssh\id_rsa_other" root@192.168.2.3
