diff --git a/pkg/auth/server.go b/pkg/auth/server.go
index feb340f633730ceebad8b666fa64282c56ec180c..c82c450f3cbbb6bb7819899b8d4529a0cedad509 100644
--- a/pkg/auth/server.go
+++ b/pkg/auth/server.go
@@ -38,7 +38,7 @@ func checkAuth(ctx ssh.Context, password, publicKey string) (res ssh.AuthResult)
 		logger.Infof("%s %s for %s from %s", action, authMethod, username, remoteAddr)
 		return
 	}
-	if resp != nil {
+	if resp != nil && resp.User != nil {
 		switch resp.User.OTPLevel {
 		case 0:
 			res = ssh.AuthSuccessful