This post will walk you through the task of enabling SSH sign in using your Public SSH Key.
This post assumes you have have already created your SSH keys in Putty or Token2Shell or whatever you favorite SSH software is. If you have follow one of our guides for that step:
Configuring SSH Keys in Putty
Method 1: uses SFTP to move the authorized_keys file to your Linux server.
Log into your Linux server as a user (not root) using SSH client with a password or using a SFTP client.
Copy the authorized_keys file from your desktop to your home folder. Usually /home/USERNAME/
Now connect to the server using an SSH client if you haven’t already.
Run the following command to make a directory within your home directory.
$ mkdir -p ~/.ssh
Next copy the authorized_keys file into the .ssh folder.
$ cp authorized_keys ~/.ssh/authorized_keys
Now change the permissions on the authorized_keys file to ensure only you can read, write, and execute the file.
$ chmod 700 ~/.ssh/authorized_keys
If your system does not run SELinux you are done.
If you are on a system running SELinux or you see an error that no valid public keys were found, you will need to run the following command to fix the files context.
restorecon -R -v ~/.ssh
That is it.
Now connect to your server via SSH and you should be able to connect.