Fedora Linux Support Community & Resources Center
  #1  
Old 29th April 2007, 01:58 AM
ajamison Offline
Registered User
 
Join Date: Sep 2006
Location: Dundee, Michigan
Age: 35
Posts: 1,211
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
Reply With Quote
  #2  
Old 29th April 2007, 02:26 AM
Seve Offline
Retired Community Manager
 
Join Date: Oct 2004
Location: The GTA, Ontario, Canada
Age: 56
Posts: 12,371
Hello:
Does this guide help ?
Setup Sudo

Seve
__________________
Registered Linux User: #384977
.................................................. ............
See the Links below for more Help and those much wanted extras ... :)
Reply With Quote
  #3  
Old 29th April 2007, 03:00 AM
ajamison Offline
Registered User
 
Join Date: Sep 2006
Location: Dundee, Michigan
Age: 35
Posts: 1,211
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
Reply With Quote
  #4  
Old 9th September 2008, 03:31 AM
Waggoneer Offline
Registered User
 
Join Date: Mar 2006
Posts: 130
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.
Reply With Quote
  #5  
Old 6th March 2009, 08:04 PM
Mistoffeles Offline
Registered User
 
Join Date: Aug 2006
Posts: 8
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 08:12 PM.
Reply With Quote
  #6  
Old 23rd November 2009, 03:14 AM
bronxbomberz41 Offline
Registered User
 
Join Date: Nov 2009
Posts: 1
linuxfedorafirefox
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
Reply With Quote
  #7  
Old 6th December 2009, 02:55 AM
darksideforge Offline
Registered User
 
Join Date: Apr 2009
Posts: 51
windows_xp_2003firefox
Quote:
Originally Posted by bronxbomberz41 View Post
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!
Reply With Quote
  #8  
Old 16th February 2010, 07:00 AM
The Mishanator Offline
Registered User
 
Join Date: Aug 2009
Location: Washington (state)
Age: 21
Posts: 184
linuxubuntufirefox
darksideforge...

if u want, i wrote a script to fix that
Reply With Quote
  #9  
Old 16th February 2010, 07:35 PM
vallimar Online
Registered User
 
Join Date: Jul 2008
Posts: 1,050
windows_xp_2003safari
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 07:37 PM.
Reply With Quote
  #10  
Old 17th February 2010, 06:13 AM
The Mishanator Offline
Registered User
 
Join Date: Aug 2009
Location: Washington (state)
Age: 21
Posts: 184
linuxubuntufirefox
make /etc/sudoers writable (make sure u undo this when ur done) and

Code:
echo "username ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
Reply With Quote
  #11  
Old 17th February 2010, 09:13 PM
bodhi.zazen Offline
Registered User
 
Join Date: Jul 2006
Location: Montana
Posts: 731
windows_xp_2003firefox
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
Reply With Quote
  #12  
Old 9th May 2010, 11:19 PM
Resonance Offline
Registered User
 
Join Date: Mar 2010
Posts: 41
linuxfedorafirefox
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
Reply With Quote
  #13  
Old 21st May 2010, 08:52 PM
Resonance Offline
Registered User
 
Join Date: Mar 2010
Posts: 41
linuxfedorafirefox
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
Reply With Quote
  #14  
Old 13th September 2010, 08:29 AM
srinidhi Offline
Registered User
 
Join Date: Sep 2010
Location: Bangalore, India
Posts: 15
linuxfedorafirefox
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
Reply With Quote
  #15  
Old 13th September 2010, 10:19 PM
kurtdriver Offline
Registered User
 
Join Date: Jul 2005
Location: Vancouver, Canada
Posts: 1,573
linuxfedorafirefox
Re: Adding a user to sudoers file

Quote:
Originally Posted by srinidhi View Post
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.
Reply With Quote
Reply

Tags
adding, file, sudoers, user

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


Current GMT-time: 18:19 (Wednesday, 01-10-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat