1

I am a user on my local machine (clientuser1). I ssh into a AWS instance server (with ip: server-ip) as . I have the public key of clientuser1 uploaded in my permission settings. I am able to

ssh <server-user1>@<server-ip>

I, then created a user on the instance, and tried ssh'ing into the instance:

ssh <server-user2>@<server-ip>

I got a response:

Permission denied (publickey).

I tried creating a public-private key pair on the on the server and sent the private key of

ssh -i <pvt key of server-user2> <server-user2>@<server-ip>
Vigneshwaren
  • 1,273
  • 2
  • 15
  • 24
  • Is the key with permission 400 on your lical disk? It will deny login if the key is not protect d. – didiz Apr 25 '17 at 05:35
  • I do have 400 as the permissions for the identity file – Vigneshwaren Apr 25 '17 at 06:17
  • Check which server user the key needs, sometimes it is ecs2-user, sometimes it is something else – didiz Apr 25 '17 at 06:53
  • Possible duplicate of [Trying to SSH into an Amazon Ec2 instance - permission error](http://stackoverflow.com/questions/8193768/trying-to-ssh-into-an-amazon-ec2-instance-permission-error) – didiz Apr 25 '17 at 06:54

2 Answers2

1

For Googlers:

Other than the common permission-related causes, if the system disk is full, SSH server will also respond "permission denied".

dz902
  • 4,782
  • 38
  • 41
0

The answer that worked was

ssh-add <id_rsa>

This added the new key to ssh-agent.

Vigneshwaren
  • 1,273
  • 2
  • 15
  • 24