Guides 11792 Published by

The guide begins by ensuring sudo is installed on Fedora, noting that some minimal server images might not include it out of the box. Next, it walks through creating a new user with a home directory and bash shell, setting a strong password, and adding that account to the wheel group so it can run privileged commands. Once the new user logs in you can confirm sudo works by executing `whoami` or checking group membership, and if desired fine‑tune the defaults in `/etc/sudoers.d/90-wheel` with visudo for extra control. The article wraps up by reminding you to keep root locked down and use this separate admin account for everyday work, pointing out that a few extra keystrokes yield worthwhile added security.



How to Create a Sudo User on Fedora Linux

If you’ve ever found yourself stuck at a root prompt only to realize that you can’t run sudo from another account, this quick guide will get you back in the driver’s seat. We’ll walk through creating a normal user and giving them wheel‑group sudo rights—no fuss, no surprises.

1. Make sure sudo is installed
sudo dnf install -y sudo

Why this matters: Fedora ships with sudo pre‑installed on most workstations, but a minimal server install might not. Without it you can’t elevate privileges from a regular account.

2. Create the new user
sudo useradd -m -s /bin/bash johndoe
  • -m creates the home directory.
  • -s /bin/bash sets the login shell to Bash, which most of us are comfortable with.

Real‑world note: I once had a colleague try to install software as root and accidentally left some files owned by a non‑admin account. The fix was simple—add that user to wheel—but it caused chaos until we caught up on permissions later.

3. Set the password
sudo passwd johndoe

You’ll be prompted twice; use a strong, memorable password. If you’re already logged in as root, skip sudo here.

4. Add them to the wheel group
sudo usermod -aG wheel johndoe
  • The wheel group is Fedora’s default sudoers group.
  • -aG appends the user to the group without stripping other memberships.

Why this matters: Without this step, any attempt to run sudo will be denied with “User not in sudoers” and you’ll wonder why. Adding to wheel grants full admin rights while keeping your account separate from root.

5. Verify sudo access

Switch to the new user (or ask them to log in) and test:

su - johndoe
sudo whoami

If everything is set up correctly, you’ll see root. If not, double‑check that the user is in the wheel group with:

groups johndoe

You should see wheel listed.

6. (Optional) Fine‑tune sudo permissions

Edit /etc/sudoers.d/90-wheel if you want to tweak defaults or restrict commands. Use visudo for safe editing—no syntax errors allowed.

sudo visudo -f /etc/sudoers.d/90-wheel

Example entry that allows wheel members to run anything but requires a password:

%wheel ALL=(ALL) ALL
7. Wrap‑up

You now have a fully functional sudo user on Fedora. Remember: keep the default root account locked down and use your new user for everyday tasks. The extra layer of protection is worth the few extra keystrokes.