Change SSH key-pair of running Amazon EC-2 instance

A lot of time you would need to change the ssh key file for security reasons for running ec-2 instance.
Given below are the steps to reset the key.

Step 1: Create a new key pair from AWS Console.

Give a name to the key-pair , it will download an .pem file.
2. Change the permission of the .pem file

  chmod 600 ***.pem

3. Generate a public key from the private key .pem file in your local machine.

ssh-keygen -y

4. Copy the public key
5. Login to your ec2 console using the old .pem file
6. Open the file ~/.ssh/authorized_keys

  nano ~/.ssh/authorized_keys

7. Append the new key to your file which you have copied. Don’t remove the old ssh key till you check with the new key. In case of any problem you wont be able to login at all.
8. logout from ssh. and login to your ec2 using the new key. Now you can safely go to the ~/.ssh/authorized_keys and remove the old key.

русское порно

Leave a Reply

Your email address will not be published. Required fields are marked *

Follow by Email