FedoraForum.org - Fedora Support Forums and Community
Page 1 of 3 123 LastLast
Results 1 to 15 of 37
  1. #1
    Join Date
    Sep 2006
    Location
    Dundee, Michigan
    Age
    47
    Posts
    1,215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Adding a user to sudoers file

    Ok i read somewhere that you can use the 'visudo' command to add a user or group to the sudoers list file to allow for some root procedures (like yum and rpm installation) to be done using the sudo command with no password.

    I can load visudo however after adding my user following the root entry as an example i try to save my changes and exit but i never seem to have the changes merged to the sudoers file.

    I do get an error message saying "no changes saves add ! to override" what is the command to save in visudo?

    The manual entry "man visudo" does not help at all
    Andrew Jamison
    IRC:ajamison5579
    Linux Counter # 435228
    -----------------
    Wiki page helping to show appropriate Fedora versions of Ubuntu commands [url=https://fedoraproject.org/wiki/FedorianDictionary]Fedora Dictionary[/url <--- Outdated been very busy looking to update it soon

  2. #2
    Seve's Avatar
    Seve is offline Retired Community Manager
    Join Date
    Oct 2004
    Location
    The GTA, Ontario, Canada
    Age
    68
    Posts
    12,371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello:
    Does this guide help ?
    Setup Sudo

    Seve
    Registered Linux User: #384977
    .................................................. ............
    See the Links below for more Help and those much wanted extras ... :)


  3. #3
    Join Date
    Sep 2006
    Location
    Dundee, Michigan
    Age
    47
    Posts
    1,215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes very much so thank you it is alot easier that way then the way i was attempting it
    Andrew Jamison
    IRC:ajamison5579
    Linux Counter # 435228
    -----------------
    Wiki page helping to show appropriate Fedora versions of Ubuntu commands [url=https://fedoraproject.org/wiki/FedorianDictionary]Fedora Dictionary[/url <--- Outdated been very busy looking to update it soon

  4. #4
    Join Date
    Mar 2006
    Posts
    130
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also a lot easier than using the visudo program.
    Fedora 11 x86_64 (Beta)
    AMD 64 X2 5600
    BIOSTAR TFORCE 550 Socket AM2 NVIDIA nForce 550 Motherboard
    3.958380 GB Corsair DDR2 800
    EVGA Nvidia GeForce 8600 GT
    80g SATA v3.0 Hitach Deskstar HD
    2 160GB SATA v3.0 RAID 1

    I also have F11 (Beta) on a Dell XPS 1210 and F9 on my wifes Sharp PC-CL1-7DA laptop.

    Fedora user since FC4.

  5. #5
    Join Date
    Aug 2006
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    visudo isn't actually what you use to do the editing, visudo just "checks" the file when you are done. If your changes are not valid, it doesn't update the actual sudoers file (you were actually editing a temporary copy of sudoers).

    The actual editor you are using is vi (or vim or whatever variant of vi your distro uses), so if you know how to vi you're good to go.

    Edit: I'm not sure if this is so, but if you continue to have problems with sudoers not accepting changes, make it temporarily writable (chmod +w /etc/sudoers) and then change it back when you are done (chmod -w /etc/sudoers).
    Last edited by Mistoffeles; 6th March 2009 at 09:12 PM.

  6. #6
    Join Date
    Nov 2009
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks that worked for me. I've used ubuntu for a couple years and after the Karmic update i've been having lots of issues with wireless, flash, restricted drivers, etc so after some debian soul searching I tried Fedora. never encountered the sudoers thing in ubuntu

  7. #7
    Join Date
    Apr 2009
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bronxbomberz41
    Thanks that worked for me. I've used ubuntu for a couple years and after the Karmic update i've been having lots of issues with wireless, flash, restricted drivers, etc so after some debian soul searching I tried Fedora. never encountered the sudoers thing in ubuntu
    This is EXACTLY the problem I've been having; I was an Ubuntu user since 8.10 when 9.10 started giving me grief (although I dabbled with F10 back in July for a bit).

    I'm also realizing that, every time "we" used to use "sudo" in Ubuntu, "we" are now supposed to use "su" in Fedora...and there are all sorts of addenders to "su".

    Graphical logins as root aren't allowed with the Gnome login screen, but supposedly you can switch over and use the KDE login screen (with a GDE) and graphically login that way...but I haven't tried it yet. I rather wish F12 were more like CentOS 5.4 where you can just manipulate the entire system as root and then logout/login as a different user....much easier for Admin tasks, but also less secure I suppose.

    I also don't like the whole "visudo" element...am currently trying to learn how to work around that with gedit...i HATE vi/vim!

  8. #8
    Join Date
    Aug 2009
    Location
    washington
    Posts
    185
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    darksideforge...

    if u want, i wrote a script to fix that

  9. #9
    Join Date
    Jul 2008
    Posts
    1,347
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There was a recent change to sudo that adds a config directory so you don't have to touch the main sudoers file at all, just dump a file into /etc/sudoers.d/<filename>, set the perms to 0440, and provided there aren't typos, should be all set. You will need at least sudo-1.7.2p2-3 at present to enable this. The 'sudoers.d' directory won't yet exist if your sudo package is too old yet.
    Code:
    [root@linux sudoers.d]# rpm -q sudo        
    sudo-1.7.2p2-3.fc12.x86_64
    [root@linux sudoers.d]# ls -l
    total 4.0K
    -r--r----- 1 root root 103 Feb 12 11:30 wheel
    [root@linux sudoers.d]# cat wheel 
    ## Allows people in group wheel to run all commands (without password)
    %wheel  ALL=(ALL)       NOPASSWD: ALL
    Last edited by vallimar; 16th February 2010 at 08:37 PM.

  10. #10
    Join Date
    Aug 2009
    Location
    washington
    Posts
    185
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    make /etc/sudoers writable (make sure u undo this when ur done) and

    Code:
    echo "username ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

  11. #11
    Join Date
    Jul 2006
    Location
    Montana
    Posts
    733
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    visudo is useful as it checks for syntax errors. Not as critical on Fedora as you can fall back to su if there is a config error (not true with Ubuntuu as the root account is locked by default, so one would need to boot to recovery mode ... ).

    At any rate, if you do not like vi/vim, set your editor to something else, either on the command line or in /root/.bashrc

    export EDITOR=gedit
    export EDITOR=nano

    take your pick

    Now if you are familiar with the syntax of /etc/sudoers there is nothing wrong with using the alternate methods.
    If it is not broken, tweak it... If you break Fedora you get to keep both pieces :p

  12. #12
    Join Date
    Mar 2010
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Adding a user to sudoers file

    vi is simple but not obvious.

    #visudo
    using the arrows travel down the page until you see
    root ALL=(ALL) ALL
    To add your username just under this type i (This is insert mode)
    MyUname ALL=(ALL) ALL
    hit Esc to escape from insert mode and enter command mode
    Type shift colon x (:x) to exit and save changes
    Type shift colon q (:q) to exit without saving

    Vi Cheat Sheet

  13. #13
    Join Date
    Mar 2010
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Adding a user to sudoers file

    There seems to be some disagreement in other threads about the modification and the security implications of the sudoers file.
    Curious about the statements and methods described by posters I hopped on the google train.
    My first couple of searches didn't reveal much useful additional info, but later found a good site that explains everything from modification to security implications.

    Using sudo

    And just in case the internet goes out, I saved a local copy.
    Fedora 12 x86_64 KDE | Toshiba Laptop
    Updated to latest Firefox using: su -c "yum --enablerepo=rawhide install firefox"
    Network Manager isn't working completely-Can't edit settings
    Fixed partial working Synaptics Touchpad using method here

  14. #14
    Join Date
    Sep 2010
    Location
    Bangalore, India
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Adding a user to sudoers file

    Hi I am Newbie to Fedora, I tried to set a username(Srinidhi) as a sudoer, using the command,
    " echo 'Srinidhi ALL=(ALL) ALL' >> /etc/su"
    it did worked but the problem is when i execute any command with sudo it says
    "Srinidhi is not allowed to run sudo on localhost"

    Where is the mistake being done?

    ---------- Post added at 12:59 PM CDT ---------- Previous post was at 12:40 PM CDT ----------

    Guys I could figure it out. Went to sudo file using visudo and set the user profile as sudoer now it s working.
    Thanks Anyways

  15. #15
    Join Date
    Jul 2005
    Location
    RainCity
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Adding a user to sudoers file

    Quote Originally Posted by srinidhi
    Hi I am Newbie to Fedora, I tried to set a username(Srinidhi) as a sudoer, using the command,
    " echo 'Srinidhi ALL=(ALL) ALL' >> /etc/su"
    it did worked but the problem is when i execute any command with sudo it says
    "Srinidhi is not allowed to run sudo on localhost"

    Where is the mistake being done?

    ---------- Post added at 12:59 PM CDT ---------- Previous post was at 12:40 PM CDT ----------

    Guys I could figure it out. Went to sudo file using visudo and set the user profile as sudoer now it s working.
    Thanks Anyways
    Glad it's working for you, the reason it didn't earlier is that you were redirecting to the wrong filepath, to /etc/su rather than /etc/sudoers. Now you have a file in /etc/ that is of little use to you.
    Kurt Driver
    Vancouver, Canada

    https://www.wikitree.com/wiki/Driver-1479

Page 1 of 3 123 LastLast

Similar Threads

  1. adding username to sudoers file
    By Matt26 in forum Using Fedora
    Replies: 5
    Last Post: 13th June 2009, 08:14 PM
  2. How to add my user in sudoers ?
    By goxi in forum Using Fedora
    Replies: 11
    Last Post: 21st May 2009, 01:04 PM
  3. Add user to sudoers file (fedora 10)
    By PCessna in forum Using Fedora
    Replies: 5
    Last Post: 31st January 2009, 11:54 AM
  4. Not in Sudoers File
    By Skoberlink in forum Using Fedora
    Replies: 8
    Last Post: 5th September 2008, 11:55 AM
  5. not in the sudoers file
    By frankje in forum Using Fedora
    Replies: 4
    Last Post: 19th April 2007, 01:37 AM

Tags for this Thread

Posting Permissions

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