You need to generate a public and a private key.
Lets say your username is linuxuser. On your local system and your remote system.
After login you need to run:
ssh-keygen -t rsa -b 4096
-t rsa is the encryption method and -b 4096 tells ssh-keygen to use 4096 bit for keys.
After that you have to ensure that your keys are located at /home/linuxuser/.ssh/. In most cases there called
id_rsa and id_rsa.pub.
Now you need to put the public key into the authorized_keys file of your target host. (lets call the host: linuxhost)
First Transfer the key: scp /home/linuxuser/.ssh/id_rsa.pub linuxuser@linuxhost:/home/linuxuser/id_rsa.pub .
Then login to the remote host (last time with password.. hopefully :-)) and enter:
cat /home/linuxuser/id_rsa.pub >> /home/linuxuser/.ssh/authorized_keys; rm /home/linuxuser/id_rsa.pub
The last step is to ensure that your private key permissions are 600. ( chmod 600 /home/linuxuser/.ssh/id_rsa )
Now you can just login to your remote machine :-)
ssh linuxhost (maybe you have to use the -i parameter: ssh -i ~/.ssh/id_rsa)
Thats it!
No comments:
Post a Comment