Users and permissions on Fedora: wheel, sudo and password policy
Fedora’s permission model has two layers that are easy to conflate: file permissions (rwx) and sudo escalation (who may become root). Both are independent of SELinux; this page covers the first two.
Measured on F45.
Who am I right now
Section titled “Who am I right now”idgetent passwd labuseruid=1000(labuser) gid=1000(labuser) groups=1000(labuser),4(adm),10(wheel),190(systemd-journal)labuser:x:1000:1000:fedora Cloud User:/home/labuser:/bin/bashIn the id output, 10(wheel) is what grants sudo. The getent passwd line has seven colon-separated fields: name, password placeholder, UID, GID, comment, home directory, login shell.
The wheel group and sudo
Section titled “The wheel group and sudo”Fedora grants sudo to the wheel group by default; the rules live in /etc/sudoers:
sudo grep -nE "^(%wheel|Defaults)" /etc/sudoers | head -555:Defaults !visiblepw64:Defaults always_set_home65:Defaults match_group_by_gid73:Defaults always_query_group_plugin75:Defaults env_resetThe granting line is %wheel ALL=(ALL) ALL (commented on some images, where # %wheel is offered as an alternative). Always edit sudoers with visudo — it checks syntax; editing by hand can lock you out of sudo.
Put your own rules in /etc/sudoers.d/, one file per rule:
sudo ls /etc/sudoers.d/90-cloud-init-userssudo tee /etc/sudoers.d/90-labadmin >/dev/null <<'EOF'labadmin ALL=(ALL) NOPASSWD:ALLEOFsudo chmod 440 /etc/sudoers.d/90-labadminCreating a user who can sudo
Section titled “Creating a user who can sudo”sudo useradd -m -G wheel -s /bin/bash alicesudo passwd aliceEach flag matters:
| Flag | Effect | If omitted |
|---|---|---|
-m | create the home directory | the user can log in but has no ~ |
-G wheel | join the wheel group | no sudo |
-s /bin/bash | set the login shell | takes the default from /etc/default/useradd |
Fedora’s defaults:
grep -E "^(SHELL|INACTIVE|CREATE_MAIL_SPOOL)" /etc/default/useraddgrep -E "^(UID_MIN|UID_MAX|PASS_MAX_DAYS|PASS_WARN_AGE)" /etc/login.defsSHELL=/bin/bashINACTIVE=-1CREATE_MAIL_SPOOL=yes
UID_MIN 1000UID_MAX 60000PASS_MAX_DAYS 99999PASS_WARN_AGE 7Two defaults stand out: PASS_MAX_DAYS 99999 means no expiry, and INACTIVE=-1 means the account is not locked even after expiry. Production usually tightens both; see below.
Adding a supplementary group: never drop the -a
Section titled “Adding a supplementary group: never drop the -a”sudo usermod -aG wheel alice # correct: appendsudo usermod -G wheel alice # wrong: replaces the whole list-G means “set the supplementary groups to exactly these”; -aG means “append”. Dropping the -a silently removes membership in adm, systemd-journal and friends — the most insidious kind of permission problem.
Verify:
id alicegetent group wheelPassword aging and locking
Section titled “Password aging and locking”sudo chage -l alice # current policysudo chage -M 90 -W 7 -I 14 alice # expire in 90 days, warn 7 days ahead, lock 14 days after expirysudo passwd -l alice # lock the accountsudo passwd -u alice # unlock-I 14 fills exactly the gap left by INACTIVE=-1: the account locks automatically 14 days after the password expires.
Check the lock state:
sudo passwd -S alicealice LK 2026-10-28 0 90 7 14 (Password locked.)The second field: P usable, LK locked, NP no password.
Deleting a user
Section titled “Deleting a user”sudo userdel -r alice # -r removes home directory and mail spool tooWithout -r the home directory stays behind — a later user with the same name may get a different UID, leaving orphaned files and mismatched SELinux labels.
Things people overlook
Section titled “Things people overlook”- Check for running processes first:
ps -u alice,loginctl list-sessions; sudo -lshows what you are allowed to do — faster than guessing;sudo -iversussudo -s: the first gives a login shell (reads/etc/profile), the second keeps the current environment;- SELinux relation: the
context=unconfined_u:...at the end ofidis the SELinux user context; see SELinux.
Related pages
Section titled “Related pages”- SELinux — the other permission layer
- SSH service and keys — remote login and key-based access
- Backup and restore — where user data lives
- Error lookup —
user ... already exists,/etc/shadow: Permission denied - Cheat sheet — user commands
- Official: Managing users and groups