SSH / Key Setup for Seamless Authentication among AWS EC2 Servers

  1. Prerequisite – In this post, it is supposed
    • the EC servers to be exists
    • the topic is related to the SSHD/SSH & Key concept
  2. Conditions – It is supposed that
    • There are two EC servers
    • The account of each server is default account, “ec2-user”
    • URL of each server is ec1.compute.amazonaws.com, ec2.compute.amazonaws.com
    • The default pem provided from AWS to access each server via SSH is ec1.pem, ec2.pem
  3. Preparation
    • Upload each pem file on each server’s home directory (~/) of ec2-user by SFTP or other way
  4. Setting Procedure
    1. log into ec1 server as ec2-user using ssh
    2. Copy ec1.pem to .ssh folder as id_dsa private key , .ssh/authorization_keys to home directory  as ec1.pub then check they are exists.
    3. Do that on ec2 server
    4. Copy ec1.pub to  ec2-user’s home directory in ec2.compute.amazonaws.com, ec2.pub toec2-user 의 home directory in ec1.compute.amazonaws.com.
    5. Run command below in the shell to register ec2.pub in ec2-user’s home directory to the ec1’s pubilc key store , ec1.pub to ec2 server’s public key store in ec2 server in same way.
    6. Open the ssh_config file then add STrictHostKeyChecking setting at the end of file to skip the by manual confirmation to add the host as known hosts when accessing servers through SSH.

      * Part of configuration file
    7. SSH Access test from each ec1, ec2 server

      *If accessible, successful.

3,083 total views, 2 views today

Leave a Reply