FedoraForum.org - Fedora Support Forums and Community
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2011
    Posts
    183

    Names in the sudoer file

    I am trying to upgrade from 25 WS to 28 WS via command line.

    Attempting the 1st command: sudo dnf upgrade --refresh , the response is that my user name is not in the sudoers file.

    After the 3 years with 25 I'm at a loss on how to add my user name to the "sudoers" file.

    Any help gratefully accepted and will be saved in my Strange Problem file.

  2. #2
    Join Date
    Nov 2008
    Location
    Canada
    Posts
    2,723

    Re: Names in the sudoer file

    Code:
    # locate sudoers
    /etc/sudoers
    You add your name to the file manually (vi or visudo). But, just about all fedora releases have the wheel group added already:

    Code:
    # cat sudoers |grep wheel
    ## Allows people in group wheel to run all commands
    %wheel  ALL=(ALL)       ALL
    # %wheel        ALL=(ALL)       NOPASSWD: ALL
    so add yourself the wheel group instead. system-config-users for ex.,

    Jumping from Fedora 25 to 28... that's quite a jump. I'll be surprised if you don't end up backing-up /home, making a list of installed packages and performing a clean install.
    Last edited by beaker_; 13th May 2018 at 01:42 PM.

  3. #3
    Join Date
    Jun 2004
    Location
    Maryland, US
    Posts
    7,301

    Re: Names in the sudoer file

    Quote Originally Posted by beaker_
    Code:
    # locate sudoers
    /etc/sudoers
    You add your name to the file manually (vi or visudo). But, just about all fedora releases have the wheel group added already:

    Code:
    # cat sudoers |grep wheel
    ## Allows people in group wheel to run all commands
    %wheel  ALL=(ALL)       ALL
    # %wheel        ALL=(ALL)       NOPASSWD: ALL
    so add yourself the wheel group instead. system-config-users for ex.,

    Jumping from Fedora 25 to 28... that's quite a jump. I'll be surprised if you don't end up backing-up /home, making a list of installed packages and performing a clean install.

    More likely his "user" doesn't have the "wheel' group on it because at install time for Fedora 25 he didn't answer 'yes' that he wanted administrator for his user. You can test that quickly be just running "id" when logged in as the user, if there's no mention of wheel in your list of groups then that's the problem. Assuming user is 'joe'

    Code:
    id
    uid=1000(joe) gid=1000(joe) groups=1000(joe)
    BTW, it's best practice in Linux now to not edit the /etc/sudoers file to add a user but rather to make a file in /etc/sudoers.d/ and put your entry in there that you would have placed in /etc/sudoers. This is because the /etc/sudoers file is a member of the 'sudo' package, suppose you edit /etc/sudoers and then later update 'sudo', your new sudoers file from the rpm will be put on disk as /etc/sudoers.rpmnew thus breaking the update until you notice and merge the two. It's more reliable to just put a file in /etc/sudoers.d/ which is "included" from /etc/sudoers:

    Code:
    ## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
    #includedir /etc/sudoers.d
    The better way would be to just add "wheel" to the user, since the %wheel line is probably already in /etc/sudoers

    Code:
    usermod -aG wheel  joe
    (append group 'wheel' to the user)

    I suppose "visudo" still edits /etc/sudoers directly because there might be multiple files in /etc/sudoers.d/ and it wouldn't know which to go to.

    You can install the "rpmconf" package and run that occasionally:

    Code:
    rpmconf -a
    that's will help you find and merge various "rpmnew" files that have made their way onto your system.
    Last edited by marko; 13th May 2018 at 06:02 PM.

Similar Threads

  1. fedora12 no sudoer file
    By Zych01 in forum EOL (End Of Life) Versions
    Replies: 2
    Last Post: 12th April 2011, 02:57 AM
  2. how to set up the sudoer file
    By Niche in forum Using Fedora
    Replies: 3
    Last Post: 20th November 2007, 05:26 PM
  3. SUDOER file.
    By charactermatter in forum Installation, Upgrades and Live Media
    Replies: 5
    Last Post: 3rd September 2007, 03:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •