Generate Public key on your system
#ssh-keygen -t rsa
vi /home/deva/.ssh/id_rsa.pub
copy content of id_rsa.pub & paste in to remote server's authorized_keys
if .ssh directory is not on remote server then follow the step
#mkdir ~/.ssh
#touch ~/.ssh/authorized_keys
& try to login on server
if u get this following error:-
Agent admitted failure to sign using the key.
Then type command
#ssh-add
### SSH Authentication Using SSH keys Using PUTTY###
At client machine:
> Generate Private and Public key using PUTTY key-gen
> Save Private and Public key at your machine for example under "Document" folder.
> Make sure that Private Key is saved with .ppk extention.
> Add public key on Remote server under $HOME/.ssh/authorized_keys file as per given procedure.
> In $HOME/.ssh/authorized_keys on server, cut/paste your public ssh key, on ONE LINE (That is very important!!!)
Do not add the BEGIN PUBLIC KEY or END PUBLIC KEY.
Do not add the rsa-key-20090614 at the end.
Make sure, there is ssh-rsa at the beginning, if its not in public key then add manually.
It should be something like:
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIBzPeFQv+295iKzuuPH0jA9449pSHVpCwXvCR9EstmYh...
>>>> On Server <<<<
Note: Disable Passwordauthentication in sshd_config file
#vi /etc/ssh/sshd_config
PasswordAuthentication no
#service sshd restart
#mkdir $HOME/.ssh
#touch $HOME/.ssh/authorized_keys
#chmod 700 $HOME/.ssh
#chmod 600 $HOME/.ssh/authorized_keys
Note: To add Public key on Server, Make sure spaces are not at the end or begining.
#vi $HOME/.ssh/authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQChjD5jiLDPeC4jDF8kS8nN6eNzAb8D0ElqeUbCy6IGZqtqNwRnpcYxn2oixvN5wE1AXVXIFN4h2uf7zyWqtrJUXLPH6SRiOwbLeDgqUIJgxR+JNMR63GelDCwGDcbfn19pjcM1MA9e4Fj+u4yh+rqvJ+m98HXcQXHQF83zCN0Ly35VV6WtEXu+h89aHpGd9J6SynSGwq8EP24AAk/HFYgkQat2cnnwa/itlspQxQaRfg6LlHJc9h/YqPIg/xUO4yV+rCq6Sp84ztVOXlcKFAXMCvSICysJHqdVdMcazcvvFgNRFxpmAEKfCkW2TEtJScU1Jk+s8CNIdTUNjX3ha6Fd deva@DJ
## How to Login with ssh key using PUTTY##
Open PUTTY > Category > Connection > SSH > Auth
Under: Authentication Parameter > Browse Your Private key (.ppk) file
Then: Go to "Session" at the top of PUTTY
Login: Login by entring your server IP or Hostname
No comments:
Post a Comment