Why should you use this?
In order to have a better and easier time with Linux and increase security by not using a password to login and it simplifies the system as the SSH Key will act as a constant, effectively cutting down the time required to input the sudo password. (If you follow the whole guide).
Required Knowledge
Command Line Interface (CLI) Basic understanding.
Required Software
PuTTY – https://putty.org/
How to guide
First open Powershell in Windows
Run command:
ssh-keygen (.exe)
Follow the guide on screen
Then type:
"cat ~/.ssh/id_rsa.pub"
This will spit out a long string, copy this string, as its needed later.
Note: If you gave your key a name, it will be located in ~/ instead.
A bit of Information
The squiggly line “~” referrers to “home” folder.
Windows: C:\users\
Linux: /home/<user>
Cat is a tool to view contents of files.
Connect to your remote Linux server
Login with your credentials and password.
Type:"echo insert_string_here >> ~/.ssh/authorized_keys"
What this does is inputs your data string into the file “authorized_keys”
Creating the correct file type for Putty
Open PuttyGen
Click on 'Load'
Browse to: "C:\users\.ssh\"
Click in the bottom right corner "PuTTY Private Key Files"
Select "All Files"
Select your 'file' (file doesn't have an extension)
Click Open
Click "ok"
Click on "Save private key"
Select the location you want to save the file to, and remember the location.
Note: If you gave your file a specific name, its located in "C:\users\\"
PuTTYGen is bundled with the PuTTY installation
Importing the SSH Key to Putty
In the left side of the window, go to "SSH"
Click on the + icon
Go to "Auth"
Click on the + icon
Select Credentials
Browse to the file you saved earlier,
Click "Open"
In the left pane scroll back up to "Session"
Input "Host Name / IP Address"
Click Open
Input your username and press enter.
You should now be logged in.
Quality of Life: Saved Sessions. Input a Name for the server.
Click on Save. It should now appear in the list below.
This allows you to quickly start another session.
To disable password login:
Sudo nano /etc/ssh/sshd_config
Scroll down until you find "#PasswordAuthentication yes"
Change this to "PasswordAuthentication no"
Save and Exit
This completely removes the ability to login with a password
Extra quality of life
sudo passwd -d <username>
sudo systemctl restart ssh
This removes your password from your user and restarts the ssh server.
This removes the need to type your password when using sudo
A quick and dirty guide, let me know if you got any improvements or questions. (pictures will be added at some point)