[client] Report a missing OS user in the SSH login error message

The session handler mapped a failed user lookup to the generic
"User authentication failed", which reads as a rejected SSO login even
though the JWT was accepted. Name the missing user instead.
This commit is contained in:
Zoltan Papp
2026-09-07 23:42:27 +02:00
parent 5cb6b0d33b
commit 32bfc48960
+4
View File
@@ -119,8 +119,12 @@ func (s *Server) handlePrivError(logger *log.Entry, session ssh.Session, err err
// buildUserLookupErrorMessage creates appropriate user-facing error messages based on error type
func (s *Server) buildUserLookupErrorMessage(err error) string {
var privilegedErr *PrivilegedUserError
var notFoundErr *UserNotFoundError
switch {
case errors.As(err, &notFoundErr):
return fmt.Sprintf("user %q does not exist on this host\n", notFoundErr.Username)
case errors.As(err, &privilegedErr):
if privilegedErr.Username == "root" {
return "root login is disabled on this SSH server\n"