Page 1 of 1

[Help] [BUG] SSH key based authentication does not work

Posted: 23 Aug 2025, 12:16
by storageninja
Hi

I noticed that ssh key based authentication does not work. The file rights are no correct in the home folder, after the below enhancements it start working.

Code: Select all

chmod 600 ~/.ssh/authorized_keys
chmod 700 ~/.ssh/
chmod 755 ~/
TNAS logs during the debugging:

Code: Select all

Aug 22 22:46:06 TNAS sshd[34104]: Authentication refused: bad ownership or modes for file /home/<username>/.ssh/authorized_keys
Aug 22 22:46:10 TNAS sshd[34104]: Connection closed by authenticating user <username> 172.16.1.168 port 50603 [preauth]

Re: [Help] [BUG] SSH key based authentication does not work

Posted: 23 Aug 2025, 22:20
by TMtina
Have you recently modified the permissions or ownership of this file, or moved the user's home directory? These operations might affect SSH's verification of the key file.

Re: [Help] [BUG] SSH key based authentication does not work

Posted: 23 Aug 2025, 22:26
by storageninja
TMtina wrote: 23 Aug 2025, 22:20 Have you recently modified the permissions or ownership of this file, or moved the user's home directory? These operations might affect SSH's verification of the key file.
Nope not as I'm aware of, this is a default fresh installation. I installed the TOS twice and twice it did not work out of the box. Try to reproduce in your lab and I assume you see the same.

Re: [Help] [BUG] SSH key based authentication does not work

Posted: 13 Oct 2025, 23:57
by j.mrtns
Hello,
I was looking for a way to shutdown NAS thru ssh command from my Home Assistant installation and was facing an issue with ssh key authentification not working on my F8 Plus NAS (TOS 6.0.783).
I can confirm there seems to be a bug about files ownership in '.ssh' folder not allowing public keys installed to be correctly read, and that the solution provided by storageninja with ownership changes works for me.
Please took a look at it for future releases !