KnowledgeBase
How to add your SSH public key for CentOS
- KnowledgeBase /
- VPS serveur dédié /
- How to add your SSH public key for CentOS
How to add your SSH public key for CentOS
In this tutorial we will add our public key for SSH authentication. There are many benefits to this type of installation that include:
No need to enter a password (unless you encrypt your keys with password protection * recommended *)
Once public / private key pair authentication is configured, you can disable password authentication completely and allow access via the key. Stops brute force attacks in his titles.
Once you have your public key that you generated via PuTTY and / or Linux Command Line, you will need to add to the destination server that you are trying to connect to.
If you have not yet generated your public and private key, you can follow one of the howtos below:
No need to enter a password (unless you encrypt your keys with password protection * recommended *)
Once public / private key pair authentication is configured, you can disable password authentication completely and allow access via the key. Stops brute force attacks in his titles.
Once you have your public key that you generated via PuTTY and / or Linux Command Line, you will need to add to the destination server that you are trying to connect to.
If you have not yet generated your public and private key, you can follow one of the howtos below:
How to Set Up SSH Keys with PuTTY
How to Set Up SSH Keys with Linux Commandline
To do this we will first create the hidden .ssh directory:
mkdir ~/.sshNow we will create/edit the authorized_keys that will be located inside the .ssh directory we just created.
vi ~/.ssh/authorized_keysYou 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_keyLet’s now set permissions on the key files:
chmod 700 ~/.ssh chmod 600 ~/.ssh/id_rsaThe above permissions are needed if StrictModes is set to yes in / etc / ssh / sshd_config (default).
You should now be able to SSH to your server using your SSH key authentication.
Open ticket
Submit a support ticket