diff --git a/cmd/admin-handlers-users.go b/cmd/admin-handlers-users.go index e7537a70f..47b04b7ad 100644 --- a/cmd/admin-handlers-users.go +++ b/cmd/admin-handlers-users.go @@ -491,6 +491,12 @@ func (a adminAPIHandlers) AddServiceAccount(w http.ResponseWriter, r *http.Reque } // Disallow creating service accounts by root user. + if owner { + writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(ErrAdminAccountNotEligible), r.URL) + return + } + + // Disallow creating service accounts for root user. if createReq.TargetUser == globalActiveCred.AccessKey { writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(ErrAdminAccountNotEligible), r.URL) return