I just created an ec2-instance with Amazon Linux 2 OS, then logged in to the system using login:
ec2-user and an associated privatekey. Next, I created a new user
x and copied the
.ssh/authorized_keys file from the
ec2-user home directory to the
x user home directory. Finally, I changed ownership of the
authorized_keys file to
sudo ls -ald /home/x/.ssh drwxrwxr-x 2 x x 29 Sep 18 16:42 /home/x/.ssh
sudo ls -al /home/x/.ssh/authorized_keys -rw------- 1 x x 387 Sep 18 16:42 /home/x/.ssh/authorized_keys
Now when I am logging as user
x using the same private key, I am getting the error shown below:
ssh -i /some/path/aws/privatekey.pem email@example.com firstname.lastname@example.org: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
How might one fix this so a successful login is possible?
authorized_keys file hold any user information too.)
A similar question that did not help: ssh : Permission denied (publickey,gssapi-with-mic)