In this video let us setup SSH key Authentication. We’ll use Puttygen to generate the SSH key pair. We’ll then login via putty to setup the SSH key login.
This video is intended for Windows users who want to setup SSH Keys on a Linux Server.
Using PuTTYgen on Windows to generate SSH key pairs
The playlist links for this Cyberpanel Tutorial Series:
[Windows] Cyberpanel Tutorial Playlist for Windows Users: https://www.youtube.com/playlist?list=PLhhBJ0l9FKMMjvoFS6x2Glfdrrke5iYe6
[Linux / Mac] Cyberpanel Tutorial Playlist for Linux/Mac users : https://www.youtube.com/playlist?list=PLhhBJ0l9FKMOK7ofuOwhqe3E_TMRou-Q4
In the previous video you saw how to create a new sudo user :
previous video: https://youtu.be/MZpNoErVfgE
The Full Cyberpanel Tutorial Playlist : https://www.youtube.com/playlist?list=PLhhBJ0l9FKMMjvoFS6x2Glfdrrke5iYe6
If this video was helpful to you, please consider supporting my channel : https://paypal.me/rwahowa
The following are steps taken from this post : https://bizanosa.com/vultr-tutorial-centos7-putty/
Use the post linked above in following along.
Once PuTTygen is opened, click generate and Keep moving your cursor in the area highlighted with the red box. Keep Moving the mouse randomly until the Key is fully generated.
generate ssh keys in puttygen
For extra security, Add a Key Passphrase to your SSH keys.
Puttygen how to use
Then click , Save Private key. Store it in a secure area because without it you will not be able to log into your Server after we disable password and root login. Also ensure you can remember you Passphrase because there is no way to retrieve it.
Don’t close puTTygen yet. Copy all the Text in the text box Under : Public Key for pasting into openSSH.. Copy it into a text editor because we’ll use it in a moment.
Copy all the SSH key from puttygen
Ensure when you copy it, it is pasted in a straight line as follows . Save the file because you may need it in future.
Store your public SSH Key
Make a directory and copy SSH Keys for the new User (Still under Windows Solution Section)
First, open a new Putty Window because we need to log into our server again.
Open Putty, double click on your saved Session.
[ Important ] This time round we’ll use your newly created user, not the root user. Enter username as the new User you have just created.
Enter the password you created for the new user.
You are now logged into your server.
Make the directory and copy ssh keys into it
Paste the below into your command window. This will create the directory and then the second will open it in a command editor called nano . You will then be able to paste your public SSH key in there.
sudo mkdir ~/.ssh;
sudo nano ~/.ssh/authorized_keys
Nano is going to open up authorized_keys. Copy the public key you saved from puttygen .
Right click to paste. Ensure it is copied in a straight line. In one line that is.
add public ssh into centos via putty
Then press CTRL X to exit. Then Y to accept changes. Then press enter.
Change Access Levels for the SSH Folder and SSH Key File
Now let us change the permissions for the folder and the public Key Enter the commands below.
sudo chmod 700 -R ~/.ssh
sudo chmod 600 ~/.ssh/authorized_keys
Then change ownership to your new user’s Folder …
sudo chown -R joe:joe /home/joe
In the above (that is, sudo chown -R joe:joe /home/joe ), change all instances of joe to the non-root user you created.
Confirm you can log in via SSH with the non-root user
You will need to confirm that you can login into your Server via SSH. This is because in the steps below you will disable password login. You don’t want to get locked out. First enure your non-root user can login via SSH only.
Let us login via PuTTy . Add the Hostname or IP. Use your IP from your Vultr Dashboard.
login via putty ssh
Then ,all the way down at the bottom you will see SSH.
Expand it then click on AUTH.
ssh auth login with private key
Then click on Browse and browse to the location of your private key. It is stored as .ppk.
browse to your ssh pivate key
Let us save this session so that we don’t have to do this every single time we want to log in. Scroll up to Click on session. Under Saved sessions, give it a name and click save.
Save Putty session
To log in…. Now that you have saved your session, login will be as follows:
Double click on the new session you have just created. Then log in as the user you created, the non-root user.
If you added a Passphrase for your SSH key, then type it in.
If you log in successfully then the SSH has been setup correctly for your non-root user . Hence you can now disable the root user login and you can also disable password login into your server. All these will be covered below.
GET SOCIAL WITH ME:
WEBSITE : http://rwahowa.com