diff --git a/src/middlewared/middlewared/plugins/account.py b/src/middlewared/middlewared/plugins/account.py index aa64fc6fe93b5..fb98257e2341b 100644 --- a/src/middlewared/middlewared/plugins/account.py +++ b/src/middlewared/middlewared/plugins/account.py @@ -927,6 +927,9 @@ def do_delete(self, audit_callback, pk, options): if user['builtin']: raise CallError('Cannot delete a built-in user', errno.EINVAL) + if user['immutable']: + raise CallError('Cannot delete an immutable user', errno.EINVAL) + self.middleware.call_sync('privilege.before_user_delete', user) if options['delete_group'] and not user['group']['bsdgrp_builtin']: