Ubuntu 26.04 sudo-rs: wetin change for sudoers
Ubuntu 26.04 don make sudo-rs default. Wildcard arguments no go match again; see the exact sudoers rule to replace and why Ubuntu 24.04 no dey affected.
Ubuntu 26.04 LTS dey use sudo-rs as default sudo
Ubuntu 26.04 LTS dey ship sudo-rs as the default sudo, so the sudo command for fresh server go run the Rust reimplementation instead of the original C program. Most sudoers files go still work exactly as before. The rule wey go break na the one wey get wildcard inside command arguments, because sudo-rs no dey match glob patterns against argument text: the only wildcard wey e accept there na standalone * as the final argument.
Ubuntu 25.10 na the first release wey make the switch, and 26.04 LTS continue with am. Ubuntu 24.04 LTS no dey affected, because e still select the original sudo unless you install sudo-rs by hand. This matter go start when you upgrade from Ubuntu 24.04 to 26.04, or when you build new box on the newer release. If you also dey run the interim releases, how LTS and interim Ubuntu releases differ on a server explain which machine go meet change like this first.
Check which sudo your server dey actually run
No use release number take work this one out. Ask the machine.
sudo --version
update-alternatives --config sudo
dpkg -l 'sudo*'Trust sudo --version for your own box pass any version table for internet, including this page. update-alternatives --config sudo na the other half of the answer: e list every installed provider of /usr/bin/sudo and mark the one wey dem select. Package wey dey installed no mean say dem select am, so read the selection, no be package list.
Dem package both implementations during the transition. The Rust one na sudo-rs, for version 0.2.13 inside 26.04 as of October 2026. The original one, wey Todd C. Miller maintain, still dey inside sudo package; wetin change be say e programs now get .ws suffix so both fit install together: /usr/bin/sudo.ws and /usr/bin/visudo.ws, together with cvtsudoers.ws and sudoreplay.ws. We verify am against the 26.04 archive for September 2026: dpkg -L sudo list the binaries wey get suffix, and sudo-rs ship /usr/bin/sudo-rs beside dem.
Why Ubuntu switch go sudo-rs
sudo na setuid root. Any user for the machine fit start am, and e dey start with full privileges, so any memory bug inside am fit become local root exploit. CVE-2021-3156 na exactly that: heap buffer overflow wey any local user fit reach, and e dey inside released code for about ten years. Rust dey catch that kind bug for compile time, and na the main reason dem rewrite am.
The second reason na scope, and na this one dey affect your config. Original sudo don gather plenty features for three decades, and every feature mean more code wey dey run as root. sudo-rs implement only subset on purpose. Anything wey the authors see as niche or actively harmful, dem leave am out. So sudoers construct wey work for years fit simply no dey there. Your wildcard rule na one of dem.
Memory safety remove one class of bug. E no make program free from bugs, and sudo-rs don release security fixes for itself since e become the default. Patch am like any other software.
Wetin be the sudoers rules wey still dey work
Na the same file. sudo-rs dey read /etc/sudoers and the drop-in files for /etc/sudoers.d/, and the normal things wey server operator dey write dey supported:
deploy ALL=(ALL:ALL) ALL, and group forms like%sudo ALL=(ALL:ALL) ALL- the
NOPASSWD:andPASSWD:tags User_Alias,Runas_Alias,Host_AliasandCmnd_Alias- command wey get exact argument list, for example
/usr/bin/systemctl restart app-api - command wey
""follow, wey allow the command only when e get no arguments at all - command wey
*follow as the final argument, wey allow any trailing arguments - directory path wey end for
/, wey allow any command inside that directory !to remove command from list- useful subset of
Defaults, includingsecure_path,env_keep,env_check,timestamp_timeout,passwd_tries,editor,umask,targetpw,rootpwanduse_pty
Two defaults dey behave differently and fit confuse people. You no fit turn off env_reset for sudo-rs: e dey always on. use_pty dey on by default, so the command go run inside e own pseudo-terminal.
Why your wildcard sudoers rule stop matching
Wildcards still dey allowed for one place: the command file name. Rule wey be %ops ALL = /sbin/fsck* still permit sudo fsck and sudo fsck_exfat, because * dey part of the path wey system dey match against filesystem.
Inside argument list, sudo-rs accept only two special forms, and none of dem be pattern. "" mean say no arguments dey. Standalone * as the final argument mean zero or more trailing arguments. Every other argument must be literal text. So %ops ALL = /sbin/service ntp * dey okay, because ntp na literal and * stand alone for last position. But rule like this one no grant anything wey you intend:
deploy ALL=(root) NOPASSWD: /usr/bin/systemctl restart app-*app-* na pattern inside an argument. Since sudo-rs 0.2.13, wey version 26.04 ship with, wildcard anywhere inside arguments apart from standalone final * na explicit parse error. So visudo reject the line, the rule no cover systemctl restart app-api, and sudo refuse the command. Two commands fit show you the real result of any rule for your own server: sudo -l -U deploy, when you run am as root, print wetin that account fit actually run; and sudo visudo -c tell you whether the file parse at all. Run dem before you start editing anyhow.
Wildcard rule na always be one hole
For the original sudo, dem join the arguments wey you type into one string, then dem match am against the rule argument string with glob. Glob dey match whitespace. Na this part almost everybody dey miss.
sudo-rs documentation give the clearest example. Rule of /bin/rm *.txt still allow sudo rm -rf /home .txt, because the one * swallow -rf /home and the joined string still end with .txt. The rule read like "only text files". But the real meaning na "any arguments at all, as long as the line end with .txt".
The same thing apply to the systemctl example. Because dem compare the arguments as one joined string, pattern for the end fit also match anything wey you append after am. So restart app-* cover restart app-api plus any other arguments wey the caller add. Pattern inside one argument dey expose the arguments around am, and na for arguments command power dey. sudo-rs reject this construct instead of trying to make am safe, because no general safe form dey for am.
Replace wildcard with explicit command list
Most wildcard rules dey exist because person no wan type four lines. Type the four lines.
Cmnd_Alias APP_RESTART = /usr/bin/systemctl restart app-api, /usr/bin/systemctl restart app-worker
Cmnd_Alias APP_STATUS = /usr/bin/systemctl status app-api, /usr/bin/systemctl status app-worker
deploy ALL=(root) NOPASSWD: APP_RESTART, APP_STATUSMake sure the path correct. If rule name /bin/systemctl for system wey binary dey for /usr/bin/systemctl, e no go ever match, and the failure go look exactly like permissions problem. Confirm am with command -v systemctl and paste wetin e print.
Put the rule for im own drop-in file instead of /etc/sudoers, so package upgrade no go conflict with your edit:
sudo visudo -f /etc/sudoers.d/90-deploy
sudo visudo -c
sudo -l -U deployName the file without dot and without trailing tilde. Original sudo dey ignore files for sudoers.d wey their names get dot, so 90-deploy.conf na classic silent no-op, and following this convention no cost anything.
Use root-owned wrapper when the list don too long
When the allowed set too big to list, move the decision comot sudoers go inside one small program wey root own.
sudo tee /usr/local/sbin/app-restart >/dev/null <<'EOF'
#!/bin/sh
set -eu
case "${1:-}" in
app-api|app-worker) ;;
*) echo "app-restart: not allowed: ${1:-}" >&2; exit 1 ;;
esac
exec /usr/bin/systemctl restart "$1"
EOF
sudo chown root:root /usr/local/sbin/app-restart
sudo chmod 0755 /usr/local/sbin/app-restart
ls -l /usr/local/sbin/app-restartThe sudoers side go name only one command:
deploy ALL=(root) NOPASSWD: /usr/local/sbin/app-restart *The trailing * dey okay here because na the script, no be sudo, dey decide wetin dem allow. This one go work only as long as root own the script and nobody else fit write to am. If deploy fit write to the file, deploy fit replace wetin dey inside and run anything as root. This one worse pass the wildcard rule wey you remove. Check the mode with ls -l. If the output no clear to you, learning the drwxr-xr-x permission string go take five minutes. The same rule apply to the directory: /usr/local/sbin no suppose writable by the account either, because writable directory mean say anybody fit replace the whole file.
Give di job im own account instead of sudo rule
The better question na often why di command need root at all. A service wey dey run as im own user fit dey managed by dat user, and no sudoers line go dey involved. For system units, systemd don already delegate dat decision to polkit, so one rule fit name one unit and one operator:
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.systemd1.manage-units" &&
action.lookup("unit") == "app-api.service" &&
subject.user == "deploy") {
return polkit.Result.YES;
}
});Save am as /etc/polkit-1/rules.d/50-app-api.rules and deploy fit run systemctl restart app-api with no sudo at all. Test am from di exact context wey go use am, because rule wey work for your SSH session still need confirmation from cron before you rely on am. Either way, di account wey dey do di work suppose exist only for dat work, and na di same reason behind least-privilege user accounts for VPS.
Wetin else sudo-r no dey include
sudo -E no dey implemented. Use Defaults env_keep += "HTTP_PROXY HTTPS_PROXY NO_PROXY" to name the variables wey you need instead. Also remember say env_reset dey always on, so anything wey you no keep go clear.
Central sudoers storage for LDAP no dey available. sudoers.ldap and cvtsudoers no dey implemented, and dem remove sudo-ldap package for Ubuntu 25.10, one release before 26.04. LDAP authentication through PAM or SSSD still dey work. Na the policy-inside-directory part wey dey out of scope.
INTERCEPT, wey try stop shell escapes from command wey permission allow, no dey implemented. E no ever dey effective against determined user anyway. If rule allow person run editor or interpreter as root, the person get root access, and no sudo option fit change that.
Session recording no dey implemented, so no I/O log and no sudoreplay dey. Logging dey go syslog only, and no logfile option dey to redirect am go another place. So sudo messages go land wherever your system already dey send syslog.
You suppose switch back to sudo.ws?
You fit do am, and during the 26.04 cycle, dem still dey package the original exactly because of this reason.
sudo apt install sudo
update-alternatives --config sudo
sudo update-alternatives --set sudo /usr/bin/sudo.wsCopy the exact paths from the --config output instead of from this page, because na the list wey your own system go accept. If you wan go back to sudo-rs later, set the alternative to the sudo-rs binary path from that same list.
Keep one second SSH session open, logged in, and idle before you touch anything wey affect sudo. If sudoers file no parse, or alternative point to binary wey no dey installed, you fit lose any way to become root for remote box. Make this habit join everything else wey you do for the first ten minutes for new VPS.
Treat the switch back as deadline, no be fix. E give you one week to rewrite the rules properly. The rewrite still worth doing by itself, because every wildcard rule wey you delete was granting more access than the author understand.
FAQ
Sudoers wildcard rule for Ubuntu 26.04 stop working na why?
Ubuntu 26.04 LTS choose sudo-rs as the default sudo, and sudo-rs no dey match wildcard patterns inside command arguments. E allow wildcard for command file name, "" to mean say no arguments dey, and standalone * as the final argument. Rule like /usr/bin/systemctl restart app-* put pattern inside argument. sudo-rs 0.2.13, wey be the version for 26.04, treat am as parse error. So e no grant anything and e refuse the command. Run sudo visudo -c to see the error, and run sudo -l -U deploy as root to see wetin the account really get. Then replace the rule with exact commands or root-owned wrapper script.
How I fit switch back to original sudo for Ubuntu 26.04?
Original one dey inside sudo package, and e binaries get .ws suffix. Install am with sudo apt install sudo, then point the alternative to am with sudo update-alternatives --set sudo /usr/bin/sudo.ws. Run update-alternatives --config sudo first to read the exact paths wey your system dey offer. Keep another SSH session open while you change am. This no bring back sudo-ldap. Ubuntu remove am for 25.10, and e no dey for 26.04, no matter which implementation you select.
Sudo-rs dey read the same /etc/sudoers file?
Yes. sudo-rs dey read /etc/sudoers and the drop-in files under /etc/sudoers.d/. E use the same syntax for users, groups, aliases, run-as specifications, and the NOPASSWD tag. E implement only part of the sudoers language. So the differences show as constructs wey no dey available, instead of constructs wey behave differently. Edit with sudo visudo, then verify with sudo visudo -c before you close your session.
Wetin replace sudo -E for sudo-rs?
sudo -E no dey implemented. Original sudo don already discourage am too, because giving root process an environment wey caller fit control na a known way to change how that process behaves. Name the variables wey you really need inside sudoers instead, with line like Defaults env_keep += "HTTP_PROXY HTTPS_PROXY NO_PROXY". env_reset always dey enabled for sudo-rs and you no fit disable am. So every variable wey you no keep go clear.