EliasKotlyar / Xiaomi-Dafang-Hacks

4.18k stars 1k forks source link

SSH public-key authentication not working #1843

Closed jackkamm closed 1 year ago

jackkamm commented 1 year ago

Description

I entered my SSH public key in SystemConfiguration->SSH->AuthorizedKeys.

However, ssh still requires my password for login.

What did you do to debug the issue

I checked .ssh/authorized_keys exists and contains the correct key.

I noticed the .ssh folder has incorrect permissions which might be causing the problem:

drwxr-xr-x    2 root     root       16.0K Dec 31  1979 .ssh
-rwxr-xr-x    1 root     root         566 Feb 19 12:36 .ssh/authorized_keys

.ssh should be drwx------ (chmod 700) and authorized_keys should be -rw------- (chmod 600).

However chmod has no effect because of the FAT file system.

jackkamm commented 1 year ago

Turns out I needed to add the flag -o PubkeyAcceptedAlgorithms=+ssh-rsa:

https://superuser.com/a/1716781

Solved now -- the permissions was not the problem.