How To Add Your SSH Public Key To CentOS
Article By: samantha
![]() |
Introduction to SSH Public KeyIn this tutorial we are going to add our public key for authentication through SSH. There are many benefits to this type of setup which include:
|
Once you have your public key that you generated via PuTTY and/or Linux Commandline, you will need to add it to the destination server that you are trying to connect to.
If you have not generated your public and private key yet you can follow either of the below howtos:
How to Set Up SSH Keys with PuTTY
How to Set Up SSH Keys with Linux CommandlineTo do this we will first create the hidden .ssh directory:
mkdir ~/.ssh
Now we will create/edit the authorized_keys that will be located inside the .ssh directory we just created.
vi ~/.ssh/authorized_keys
You should now paste your public key into this file. Please note make sure they key is contained on one line.
Example should look like this:
# cat .ssh/authorized_keys ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAt+PzzOFcecabwsXnjPPd+eqrqF5d2qh6kRIbnInSgwqWlPvnyfxa2Ye1xhGjCssbYdPWA7epJ/42yMFQfg6RGynW9XjWMomWeA/1+2LGY4B7JBJQfuTdDB/AimJRQvlSmxklfktmuqx0S8u67mLdkRWY+uQD8Ec7TCxWC9pU5Hv3Hq4Rfg5KLZl/gcJyMCr3nhKXXnL65pAM0EdCmkefHxvHJ4InVuzXmDru7GVQXH1bd3Uy9UIRhIs9wORlTvwesUzWEH/eTCjGSTgGRaEguo9FISRcilODuYQrcrvN8eILZxXNsiprw0azMibonkb3yuQ6mfVxtRoB4JL3vsFIbw== solarvps_key
Let’s now set permissions on the key files:
chmod 700 ~/.ssh chmod 600 ~/.ssh/id_rsa
The above permissions are required if StrictModes is set to yes in /etc/ssh/sshd_config (the default).
You should now be able to SSH to your server using your SSH Key authentication.
Tags: Security, ssh, centos, keys, Public Key
Welcome to the healthcare-only HIPAA - GDPR compliant cloud. Exclusively hosted on a HPC environment!
Learn more or start today by choosing your secure HIPAA - GDPR compliant server's Operating System bellow and pick the package that's best for you.
BIPmd makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine, thousand or more.
>
Looking for a custom solution?
Our technicians can provide you with the best custom-made solutionss on the market, no matter whether you're a small business or large enterprise.
Get in touch
Leave a Reply
Feedbacks
![]() This work is licensed under a Creative Commons Attribution- NonCommercial-ShareAlike 4.0 International License. |