How to give SSH Key access to user on Amazon EC2 Server

    To add ssh key access to users on Amazon EC2 follow these steps Note: upload user public key file in .ssh/
        1.  Add New User: useradd -c "Mohit Sharma" mohit

        2. Navigate to user directory:  cd /home/mohit

        3. Create .ssh directory: mkdir .ssh

        4. Give Permission: chmod 700 .ssh

        5. Set Diretory Group and Onwer Permission: chown user:user .ssh

        6. Write uploaded key to authorized_keys: cat >> .ssh/authorized_keys

        7. Give Permission: chmod 600 .ssh/authorized_keys

        8. Set Group Owner Permision on keys: chown user:user .ssh/authorized_keys
    Average: 5 (1 vote)