Skip to main content

שימוש במפתח צפנה במקום סיסמא בגישה לשרתי לינוקס

Posted in

 

First, Login to the Linux machine and generate the key by command

 

ssh-keygen -t dsa -b 1024 -f $HOME/.ssh/id_dsa

 

just hit enter each time it asks for the passphrase, or enter a passphrase.

 

when done, authorize the key by coping it and set prper permissions on it.

 

cat $HOME/.ssh/id_dsa.pub >> $HOME/.ssh/authorized_keys

chmod 750 $HOME/.ssh

chmod 640 $HOME/.ssh/*

now we should down load the key to the client computer, use scp/sftp or copy & paste the output of

 

cat $HOME/.ssh/id_dsa

 

copy all text including the -----BEGIN DSA PRIVATE KEY----- and -----END DSA PRIVATE KEY-----

save the life with .pem extension.

 

sshkey01.png

 

the file is now ready to use with ssh on Linux, Unix or Mac by

 

ssh -i administrator-ubuntu.pem administrator@192.168.X.Y

 

to use this key file with putty under Windows we need to convert it to .ppk file, using PuTTYgen

 

load the private key

 

 

after successful loading the key, save the private key as .ppk file

 

sshkey05.png

 

now we can use it with PuTTY,  under Connection  category, set your username at the Data

 

sshkey04.png

 

and the path to the private key at SSH Auth

 

or use command line

putty.exe -i C:\Keys\administrator-ubuntu.ppk administrator@192.168.X.Y

 

enjoy.