Permission denied (publickey)

Permission denied (publickey)

Easy Step-by-Step Process:

  1. ssh into your root directory where you store your keys.

    ~/.ssh (directory)

  2. check if the two keys are present (private key) (public key)

    if not present add them (id_rsa) (id_rsa.pub)

  3. Run this command chmod 400 ~/.ssh/id_rsa

  4. ssh again into your server (ssh ubunt@ip)

Conclusion: Making read-only file(chmod 400 file_name): To make a file read-only means only the owner is able to read it, You have to give read permissions to the owner and no permissions to others and group, so “400” is the octal representation for this.