Adding a User's Public SSH Key to a Linux Server


This article explains how to add the public key for a specific user to a Linux server. On a Windows machine, this key can be generated by following this procedure.


1. Ensure the PUB file follows the naming convention ""

2. Upload the PUB file to the /home/ec2-user folder.

NOTE: This assumes the user will login as the ec2-user user. If they login as a different user, replace "ec2-user" with their username.

3. Open a PuTTY session to the server

4. Change to the current user's SSH folder

cd ~/.ssh

5. Backup the authorized_keys file

cp authorized_keys ak_yyyy-mm-dd

6. Append the user's public key to the authorized_keys file

cat ~/ >> authorized_keys

7. Verify that the key was appended.

cat authorized_keys