Easy SSH Keys Setup

Unless you have a specific need for allowing SSH access by password it should be disabled and use keypairs instead. Here is a quick and easy way to get this going. Note this is between two Linux machines.

Generate Keys On Server

cd .ssh

ssh-keygen -t rsa

Note: Name this different from "id" when asked. In this case I named it r1
cat r1_rsa.pub >> ~/.ssh/authorized_keys


Now we need to make a few configuration changed to SSHD config on the server:

nano /etc/ssh/sshd_config


PubkeyAuthentication yes (make sure # is removed)
PasswordAuthentication no (make sure # is removed)

service sshd restart


Grab the contents of r1_rsa

cat r1_rsa


Copy the output.

On your Linux machine do:

cd .ssh

nano r1_rsa

Paste in the contents of r1_rsa and save
chmod 600 r1_rsa


You should now be able to SSH using keys:

ssh -i r1_rsa server.ip.here


  • ssh keys, security
  • 0 Utilisateurs l'ont trouvée utile
Cette réponse était-elle pertinente ?

Articles connexes

Installing Railgun And Memcached cPanel

To work properly Railgun only has one needed dependency and that is memcached.Install And...

Resizing And securing /var/tmp On cPanel

By default on cpanel server /var/tmp is only 512MB which in most cases is too small. Increase and...