Thursday, October 13, 2016

how to login to ssh server using private key

1- generate key pair of public key and private key
$ ssh-keygen -f tohttpserver.key

- it will generate two files like below

2- set permission for the privatekey
$ chmod 600 tohttpserver.key

3- copy the public keys to server,
-  if prefer auto use  command below
$ ssh-copy-id -i test@

- if prefer manual, login into the server and create file, /home/test/.ssh/authorized_keys with content of the file
 and change the permission of the authorized_keys with command below

$ chmod 600 /home/test/.ssh/authorized_keys

4- to login using private key using the following command

$ ssh -i tohttpserver.key test1@
Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-68-generic x86_64)

 * Documentation:
Last login: Thu Oct 13 00:42:48 2016 from

No comments:

Post a Comment