How to create pem file
1) Genrate SSH Key
$ ssh-keygn
2) Create a file authorized_keys file.
$ touch ~/.ssh/authorized_keys
3) Change the permissions of the authorized_keys file.
$ chmod 600 ~/.ssh/authorized_keys
4) Change the following details in /etc/ssh/sshd_config file.
$ vim /etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys
PasswordAuthentication no
ChallengeResponseAuthentication no
UsePAM yes
Client side task
1) Genrate SSH Key
$ ssh-keygn
2) copy contant of id_rsa.pub file.
$ sudo cat ~/.ssh/id_rsa.pub
3) paste id_rsa.pub contant into server_side in ~/.ssh/authorized_keys file, and save and exit from the file.
$ sudo vim ~/.ssh/authorized_keys
4) create a duplicate file of id_rsa with .pem extention.
$ sudo cp -a ~/.ssh/id_rsa ~/.ssh/id_rsa.pem
5) change the permission of you id_rsa.pem file.
$ sudo chmod 400 ~/.ssh/id_rsa.pem
6) Now you can access the server over ssh with pem file.
$ ssh -i ~/.ssh/id_rsa.pem ubuntu@192.168.20.20
No comments:
Post a Comment
testing