2

I changed the /home dir to 750 and files in it.

Now I'm not able to connect the server with SSH public key. It’s showing the error Permission denied (publickey).

Artur Meinild
  • 26,018
raviteja
  • 21
  • 1

1 Answers1

3

It sounds like the permissions have been changed recursively.

The files in the directory ~/.ssh need very strict permissions, especially these 2 files:

-rw-------  1 am  402 2020-04-26 18:00 authorized_keys
-rw-------  1 am 2.6K 2020-05-13 23:56 id_rsa

As you can see, these files need to have permission octal 600.

To fix this, you either need physical or root access to the machine to revert the permissions to 600.

Please note that to get SSH access, the only needed file is authorized_keys (with permissions 600).

Also for reference, the following files should have permission octal 644:

-rw-r--r--  1 am  559 2020-05-13 23:56 id_rsa.pub
-rw-r--r--  1 am 5.0K 2021-02-27 18:02 known_hosts
Artur Meinild
  • 26,018