-2

I recently generated a publickey (.pem) from an EC2 instance, used ssh-add to add the key to my local machine. The IdentifyFile in the Host entry at /etc/ssh/ssh_config points to the .pem file at ~/.ssh. As noted in the AWS guide, I used chmod to edit permissions on the file before invoking ssh-add.

Unfortunately, I'm still getting:

user@deb $ ssh aws
Permission denied (publickey).

I don't think it's relevant, but for the record it's the 5th or 6th key I've generated for the EC2 instance. Any suggestions appreciated.

1 Answers1

0

If you already have a key in ~/.ssh/id_rsa on your local computer then you should be able to use the command ssh-copy-id to install the key on the remote computer.

ssh-copy-id
Usage: /usr/bin/ssh-copy-id [-h|-?|-f|-n] [-i [identity_file]] [-p port] [[-o <ssh -o options>] ...] [user@]hostname
        -f: force mode -- copy keys without trying to check if they are already installed
        -n: dry run    -- no keys are actually copied
        -h|-?: print this help