So after getting frustrated (and even recreating my ec2 instances) due to a “Permission denied (publickey)”, I finally released that the worpress builds by default as set up for SSH using the bitnami account (or at least my build was).
This means each time I login using ec2-user I get:
sudo ssh -i CPT_Default_Key.pem firstname.lastname@example.org email@example.com: Permission denied (publickey).
Being a limited human being, I will never cope with two user names. So to move over to a standard login name (ec2-user) is relatively simple. Just follow the below steps (after logging in using the bitnami account):
sudo useradd -s /bin/bash -o -u
id -u -g
id -g ec2-user
sudo mkdir ~ec2-user/ sudo cp -rp ~bitnami/.ssh ~ec2-user/ sudo cp -rp ~bitnami/.bashrc ~ec2-user/ sudo cp -rp ~bitnami/.profile ~ec2-user/
Next you need to copy your public key into the authorised keys file using:
cat mypublickey.pub >> /home/ec2-user/.ssh/authorized_key
Next to allow the ec2-user to execute commands as the root user, add the new user account to the bitnami-admins group, by executing the following command when logged in as the bitnami user:
sudo usermod -aG bitnami-admins ec2-user