I have just started a new fedora build. I just got things going, and was about to install tmux, and was hit with the message...

Error: This command has to be run under the root user

Ok. I attempt to run

sudo dnf install tmux

And now I get hit with the error

<my username> is not in the sudoers file. This incident will be reported.

I look up how to change the sudoers file, using a command called visudo. However, it appears that this command too also requires access to sudo.

visudo: /etc/sudoers: Permission denied

And with sudo

sudo visudo
<password prompt>
<my username> is not in the sudoers file. This incident will be reported

So it seems like I need to change the sudoers file to be able to use sudo, but I cannot change the sudoers file without sudo. What do I do??

  • Probably. I'm mostly on stackoverflow, don't have a ton of experience with sysadmin stuff. – Zack May 31 '16 at 15:27

Note that while you could edit the sudoers file (using visudo in a terminal as root), what you probably actually want to do is add yourself to the wheel group. See How to make Fedora user a sudoer? for details, but in short, this group is predefined as having sudo-for-everything privileges and is our standard "admin" group. (If you check the "make user an administrator" box when creating your user at installation time, that's what it does.)

To do this, you can run

gpasswd wheel -a username

as root (and then log in again as your user). Or, the GUI user configuration tool in GNOME also has this ability; go to the control panel or hit the Overview button (windows key, usually) and start typing "users". In that panel, hit "unlock" in the top right — since you're not an admin already, this should prompt for the root password. Find your user account, and where the line says "Account Type: Standard", click on "Standard" and change it to "Administrator". Again, you'll need to log out and in again, but when you do, you will have sudo access.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.