[2025-jun-17] The SlackDocs Wiki has moved to a new server, in order to make it more performant.
Table of Contents
Enabling Sudo on Slackware
/etc/sudoers (using visudo) and adding your user to the wheel group with usermod -aG wheel.
Overview
Slackware does not enable sudo by default. Administrative access is traditionally handled using su and the root account, which fits Slackware's conservative philosophy of leaving such decisions to the administrator.
This document describes how to enable sudo in a clean and explicit way by using the existing wheel group and granting it administrative privileges via /etc/sudoers.
This approach follows common Unix practices while preserving Slackware's emphasis on transparency and explicit configuration.
Design goals
- keep privilege escalation explicit
- avoid modifying default Slackware behavior unnecessarily
- use group-based access control
- ensure configuration remains auditable
- prevent accidental lockouts
Assumptions
- Slackware is running on the system
- sudo is installed (it is, by default)
- the wheel group already exists in
/etc/group(it does, by default) - the user has root access via
su - the system administrator understands the risks of sudo access
Configuring sudoers
Always edit /etc/sudoers with visudo. It validates syntax before saving — a broken sudoers file can lock you out of administrative access.
# visudo
If you prefer a different editor, set the EDITOR variable:
# EDITOR=vi visudo
Slackware's default /etc/sudoers already contains a commented line for the wheel group:
## Uncomment to allow members of group wheel to execute any command # %wheel ALL=(ALL) ALL
Remove the # to uncomment it:
## Uncomment to allow members of group wheel to execute any command %wheel ALL=(ALL) ALL
Save and exit. visudo will reject the file if there is a syntax error.
Adding a user to wheel
As root, add your regular user to the wheel group:
# usermod -aG wheel username
Replace username with your actual login name. The -aG option appends to existing group memberships rather than replacing them.
Applying the change
Group changes take effect on the next login. Log out and log back in, then verify:
$ sudo whoami root $ sudo slackpkg update
If the output of sudo whoami is root, sudo is working correctly. The second command runs slackpkg update with root privileges — a typical administrative task on Slackware.
Passwordless sudo (optional)
For a system where you want sudo without a password prompt, use this line in /etc/sudoers instead of the standard wheel line:
%wheel ALL=(ALL) NOPASSWD: ALL
This reduces friction but increases risk: anyone with access to your user account gains root privileges instantly. Use only on trusted single-user systems.
Notes and considerations
- Slackware does not require sudo. The
sucommand remains fully supported and is sometimes preferable. - Always test sudo from a separate terminal before closing your root session, in case something is misconfigured.
- Limit wheel membership to trusted users only.
- Syntax errors in sudoers can lock out administrative access — always use
visudo.
Conclusion
Enabling sudo on Slackware is a deliberate administrative choice, not a default requirement.
Using the wheel group and explicit sudoers configuration balances convenience and security while preserving Slackware's emphasis on transparency and control.
References
sudoers(5)manual pagevisudo(8)manual pageusermod(8)manual page
Sources
- Originally written by r1w1s1