Time-limited administrators and sudo rules from AD
On this page
Goal: give people administrator rights for an afternoon instead of for good, and give the help desk the few commands it needs without full rights, all managed in Active Directory.
You need: Windows Server 2016 forest functional level for time-bound membership, GPWarden on the workstations. For sudo rules: the sudo schema extension (once per forest).
Part A: administrators for a limited time
1. Turn on time-bound membership (once per forest)
Enable-ADOptionalFeature "Privileged Access Management Feature" `
-Scope ForestOrConfigurationSet -Target example.comThis cannot be undone, as for Windows; it is the feature Microsoft's own PAM solutions use.
2. A group for temporary administrators
Create a group, for example Temporary Admins, and put it in the workstations' Administrators group in a GPO linked to the Linux OU (the same GPO works for Windows 11):
Computer Configuration > Preferences > Control Panel Settings > Local Users and Groups
New > Local Group: Action "Update", Group name "Administrators (built-in)"
Add: EXAMPLE\Workstation Admins, EXAMPLE\Temporary AdminsMembers are administrators on RHEL: sudo with their own password (as UAC asks
for consent) and the GNOME administrator prompts.

3. Grant rights for a limited time
Add-ADGroupMember -Identity "Temporary Admins" -Members dana -MemberTimeToLive (New-TimeSpan -Hours 4)When the four hours are up, AD removes dana from the group, and the workstation stops granting the rights within seconds: GPWarden watches the groups in Administrators with AD's change notifications, knows each time-bound member's remaining time, and has SSSD forget the user's groups when it runs out. Measured in the lab: 6 seconds (RHEL 10) and 7 seconds (RHEL 9 in FIPS mode) after the membership ended.
A session already open keeps the groups it started with until sign-out, as a
Windows logon token does; a new sudo in that session is refused because sudo
asks SSSD again.
4. Check
Get-ADGroup "Temporary Admins" -Properties member -ShowMemberTimeToLive |
Select-Object -ExpandProperty member # <TTL=...> shows the seconds leftOn the workstation, gpwardenctl result shows how many time-bound memberships
there are and when the next one ends; the journal shows event 4732 / 4733 when
members are added or removed. sudo journalctl -u gpwardend shows "a group in
Administrators changed; memberships read again" seconds after an
Add-ADGroupMember.
Part B: rights for specific commands (sudo rules in AD)
Windows Group Policy has no per-command elevation; on RHEL, SSSD can read sudo rules from AD. GPWarden switches that on and adds no rule format of its own.
1. The sudo schema (once per forest)
As a Schema Admin, with the schema file from the RHEL sudo package
(/usr/share/doc/sudo/schema.ActiveDirectory):
ldifde -i -f schema.ActiveDirectory -c "DC=X" "DC=example,DC=com" -k2. A protected OU for the rules
Create an OU, for example OU=Sudoers,DC=example,DC=com. Only the people who may
grant elevated rights should be able to create objects in it. This matters: the
rule container is what stops someone who may create objects elsewhere (a
delegated OU) from giving themselves root.
3. The policy
Computer Configuration > Policies > Administrative Templates > GPWarden (RHEL) > System >
Use sudo rules from Active Directory: Enabled, Container holding the sudo
rules: OU=Sudoers,DC=example,DC=com. The container is required: without one (or
with a value that is not a distinguished name), the setting is not applied and
gpwardenctl result says why.

4. Rules
$ou = "OU=Sudoers,DC=example,DC=com"
# The help desk may restart the print service on every Linux computer:
New-ADObject -Name "helpdesk-cups" -Type sudoRole -Path $ou -OtherAttributes @{
sudoUser = "%helpdesk"; sudoHost = "ALL"; sudoCommand = "/usr/bin/systemctl restart cups"; sudoRunAsUser = "root" }
# Erik may read the system journal until Friday 17:00 UTC:
New-ADObject -Name "erik-logs-until-friday" -Type sudoRole -Path $ou -OtherAttributes @{
sudoUser = "erik"; sudoHost = "ALL"; sudoCommand = "/usr/bin/journalctl"; sudoRunAsUser = "root"
sudoNotBefore = (Get-Date).ToUniversalTime(); sudoNotAfter = [datetime]"2026-11-27T17:00:00Z" }sudoUser: user names, or%group.sudoCommand: a full path, optionally with arguments (*as wildcard).sudoOption: sudo options, for example!authenticatefor no password prompt.sudoNotBefore/sudoNotAfter: pass[datetime]values as above. A string must have the form20261127170000.0Z; without the.0, AD refuses it with "The parameter is incorrect".
5. When rules take effect
The user runs sudo -l to see what they may run. An end time takes effect within
seconds. A new or changed rule reaches the workstation within SSSD's refresh
interval for sudo rules, 15 minutes by default; systemctl restart sssd on the
workstation fetches it at once.
Which to use
| Need | Use |
|---|---|
| Full administrator, permanently | A group in Administrators |
| Full administrator, for hours or days | Time-bound membership in a group in Administrators |
| A few commands, permanently | A sudo rule |
| A few commands, for a window of time | A sudo rule with sudoNotBefore / sudoNotAfter |