1

I created a user called 'grader' to my instance and gave it sudo permission, also I switched the password in /etc/ssh/sshd_config to be off.

I generated a key pair in my local machine and added the public key to the instance. when i try to access the instance using the DEFAULT user provided by Amazon AWS and my generated keys it works

ssh -i "udacityLinux" ubuntu@ec2-18-218-9-117.us-east-2.compute.amazonaws.com

but when i try the same using the 'grader' user

ssh -i "udacityLinux" grader@ec2-18-218-9-117.us-east-2.compute.amazonaws.com

i get

grader@ec2-18-218-9-117.us-east-2.compute.amazonaws.com: Permission denied (publickey).

how can i fix this to be able to login using my grader user?

1

You seem to have a misunderstanding about the public key you upload to the server.

This key must be stored in the file ~/.ssh/authorized_keys for every user that should be identified by this key.

So for now you could copy the key file with

sudo cp ~ubuntu/.ssh/authoriyed_keys ~grader/.ssh

then give the file the correct owner and permissions

sudo chown grader:grader ~grader/.ssh/authorized_keys
sudo chmod 0600 ~grader/.ssh/authorized_keys

Keep in mind that now you accept all keys that you might have enabled for the user ubuntu before.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.