1. On your Windows machine I suggest installing Cmder console emulator, visit http://cmder.net/ and then download and install the Full package (with git-for-windows)
2. Open Cmder or other console software on your Windows machine, navigate to root directory, create .ssh directory and enter it
3. Create SSH key pair id_rsa & id_rsa.pub (-t is type, -b is bytes, -f is filename)
ssh-keygen -t rsa -b 4096 -f id_rsa -C "firstname.lastname@example.org"
4. Display the public key on the screen, select the printed text and copy it to clipboard
5. Login to your Ubuntu Server and install OpenSSH in case you don't have it yet
sudo apt-get install openssh-server
Before you do that, don't forget to update the repositories with:
sudo apt-get update
6. On your Ubuntu Server machine, navigate to root directory, create .ssh directory and enter it
sudo mkdir .ssh
7. Create a file authorized_keys and open it for edit
6. Paste previously copied public key and paste it to this file
7. Logout from Ubuntu Server and try to login from your Windows machine
(use your own Ubuntu Server root username & IP address)
8. If you're connecting to eg. GitHub via SSH, test your connection with this command:
ssh -T email@example.com
Copy public SSH key to your server
When you create SSH key pair on your computer, you can copy the public key to your server via terminal (console).
cat ~/.ssh/id_rsa.pub | ssh firstname.lastname@example.org 'cat >> .ssh/authorized_keys && echo "Key copied"'