I have an ubuntu ec2-instance. I have 2 users for this instance. One is the default ubuntu
user and the other is newuser
that I created.
I am logged in to my bastion host and trying to copy a file from bastion host to other instance for newuser
but I am getting Permission denied (publickey).
error.
scp hello.txt ubuntu@10.0.1.176:/home/ubuntu
works fine.
But
scp hello.txt newuser@10.0.1.176:/home/newuser
gives the aforementioned error.
Any help will be greatly appreciated.
According to the Amazon docs, you need to create a new key for your newly added user newuser
. Check this link where it is discribed what you need to do. Especially the Key Pairs for Multiple Users
section should cover what you probably need.