How to make Fedora user a sudoer?

  • I want to give a Fedora user sudo privileges. How do I do that?

  • mattdm

    mattdm Correct answer

    10 years ago

    Add the user to the wheel group:

    gpasswd wheel -a username

    I use gpasswd because not all versions of usermod have an easy way to add the user to a group without changing all the users' groups. However, on any recent Fedora, usermod username -a -G wheel should have the same effect. You could also use the system-config-users GUI, of course.

    If you are using Fedora 14 or earlier, use visudo to edit the sudoers file, removing the # from this line:

    %wheel  ALL=(ALL)       ALL

    This is the default in the sudoers file on Fedora 15 and newer, so adding the user to wheel is all you need to do. Note that this won't take effect immediately; the easiest thing to do is log out and in again.

    See also this question and answer over on Server Fault for information on granting sudo-like "auth as self" behavior to wheel group members for graphical apps which use consolehelper or PackageKit.

License under CC-BY-SA with attribution

Content dated before 6/26/2020 9:53 AM