Permission Denied(publickey)

(bhupesh ) #1

After command -
ssh ubuntu@ -L8888:localhost:8888
i am getting this error message- Warning: Permanently added ‘’ (ECDSA) to the list of known hosts.
Permission denied (publickey)
I have tried the solutions given in other threads but nothing is working.
Help me.


(ecdrid) #2

Check your .pem file and do SSH correctly


(bhupesh ) #3

I have .pub file and following the 2nd course on DL


(Ramesh Sampath) #4

Please specify what you tried and what didn’t work. Basically there are a number of reasons you might hav this problem.

  1. The permission of your .pem key or .pub file is too open. - Change it by chmod 400 <.pub or .pem file>
  2. The problem is in ssh and not in tunneling of the ports. So first get this command to work ssh ubuntu@
  3. We generally use .pem file and use ssh as ssh -i <pem key> ubuntu@<ip address>. You seem to have a slightly different pattern. You are using your public key to ssh. That’s OK if you already added your public keys to the authorized keys in the remote machine.
  4. This is a general problem of logging into Remote machine. You might find a number of posts on StackOverflow on this.

Finally, do ssh -v <rest of your command. This will give verbose output that will help you understand the issue and also post it here or in Stack Overflow (which is better for this problem).


(Shashank) #5

I had a similar error message, as I didn’t know my SSH passphrase.
Solution: Platform: GCP ✅