Tuesday, June 27, 2017

generating public and private keys

to generate public and private keys on mac:


https://docs.joyent.com/public-cloud/getting-started/ssh-keys/generating-an-ssh-key-manually/manually-generating-your-ssh-key-in-mac-os-x

(or)

1)ssh-keygen -t rsa -C "email"


2)after generating the keys
id_rsa   ----->   private key
id_rsa.pub  ---->  public key
(best practice to keep the public key  named as authorized_keys)
.ssh directory should have the chmod 700 permission.

3)Always keys will be in this following path:
   /home/kaushikg/.ssh  >  authorized_keys(public keys(id_rsa.pub)  &&    id_rsa  (private key).

4)change the  ownership of the files:

  for example:   if it is  root    root
 (means   root --- >  user  &&&&    root   --->  group)
  do this command   :
   chown    kaushikg:dev   filename(authorized_keys &&  id_rsa)
it is changed to.



(make sure the permissions are on 600 or other wise change using the chmod 600 key name).

Note:

when you generated keys through putty and your trying to use in the linux machines :

you need to convert  the putty generated keys to open ssh key format using the following command:


puttygen mykey.ppk -O private-openssh -o my-openssh-key

mykey.ppk   -   this is the key generated by the putty
my-openssh-key -  converted open ssh key

Procedure to update on the bastionhost/jumpstart server:

we have to go in to there user:

bastionhost   ———>   root user  ———>   cd /home   ——>   list of all the users 


go to for example kaushikg  user  and go in to his  /home/kaushikg/.ssh    update the authorized_keys(id_rsa.pub) and the id_rsa from your local machine to the bastion host user (kaushikg).

No comments:

Post a Comment