diff --git a/markbase-core/src/ssh_server/auth.rs b/markbase-core/src/ssh_server/auth.rs index 88e1258..9c71624 100644 --- a/markbase-core/src/ssh_server/auth.rs +++ b/markbase-core/src/ssh_server/auth.rs @@ -113,7 +113,8 @@ impl AuthHandler { if password_hash.is_none() { warn!("User not found or disabled: {}", user); - return Ok(AuthResult::Failure("Invalid user".to_string())); + // SSH_MSG_USERAUTH_FAILURE必须返回可继续使用的认证方法列表(RFC 4253) + return Ok(AuthResult::Failure("password,publickey".to_string())); } // 使用bcrypt验证密码 @@ -125,7 +126,8 @@ impl AuthHandler { Ok(AuthResult::Success) } else { warn!("Password auth failed for user: {}", user); - Ok(AuthResult::Failure("Invalid password".to_string())) + // SSH_MSG_USERAUTH_FAILURE必须返回可继续使用的认证方法列表(RFC 4253) + Ok(AuthResult::Failure("password,publickey".to_string())) } }