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).

2
  • Did you by any chance, chmod recursively ?
    – Liso
    Nov 8, 2021 at 10:17
  • Where is your server hosted? Nov 8, 2021 at 10:46

1 Answer 1

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
3
  • Thank you Artur, I wonder 750 will not do the job?
    – raviteja
    Nov 8, 2021 at 10:59
  • -rw------- 1 autobot autobot 408 Oct 5 2018 authorized_keys -rw-r--r-- 1 autobot autobot 222 Nov 8 09:21 known_hosts
    – raviteja
    Nov 8, 2021 at 11:05
  • these are the same setting for another replication server.
    – raviteja
    Nov 8, 2021 at 11:05

Not the answer you're looking for? Browse other questions tagged .