The built-in SSH server created a missing host key directory with
`os.ModePerm`, leaving it readable by all users. `gitea generate ssh
host-keys` created it with 0644, which lacks the execute bit, so the
keys could not be written into it.
`InitDefaultHostKeys` now creates the directory, including missing
parents, with 0700 for both callers. Existing directories keep their
permissions.
Fixes: https://github.com/go-gitea/gitea/issues/33533
Assisted-by: Claude Code:claude-opus-5-5
---------
Co-authored-by: silverwind <me@silverwind.io>
`TestInitKeys` verified whether a host key file was regenerated by
comparing `os.FileInfo` before and after a `InitDefaultHostKeys` call.
On systems where the OS clock / filesystem timestamp granularity is
coarse, both writes land in the same tick and get an identical mtime.
The resulting `FileInfo` is then byte-for-byte equal even though the key
was actually regenerated, so `assert.NotEqual` fails.
Since a regenerated key always produces different random bytes,
comparing the content can reliably detect regeneration.