Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 18th April 2011, 07:38 PM
AgentTeddie's Avatar
AgentTeddie Offline
Registered User
 
Join Date: Mar 2011
Location: Cincinnati, Ohio
Age: 23
Posts: 99
linuxfedorafirefox
Add user to Sudoers File?

How do I add myself to the Sudoers File? When I go to use the "Sudo" command, it tells me I am not in the Sudoers File, so I have to do "su -" to bypass it for the time being. How do I add myself? Thanks
David
__________________
I do not know why I left Fedora for Ubuntu, please I ask of you to forgive me O Blessed One, I shall never betray you again...
[SIGPIC][/SIGPIC]
Reply With Quote
  #2  
Old 18th April 2011, 07:51 PM
Miikka's Avatar
Miikka Offline
Registered User
 
Join Date: Apr 2011
Location: Finland
Posts: 293
linuxfedorafirefox
Re: Add user to Sudoers File?

Sudoers file is located in /etc/sudoers. It should have examples inside of what you need to add.
Reply With Quote
  #3  
Old 18th April 2011, 07:58 PM
AgentTeddie's Avatar
AgentTeddie Offline
Registered User
 
Join Date: Mar 2011
Location: Cincinnati, Ohio
Age: 23
Posts: 99
linuxfedorafirefox
Re: Add user to Sudoers File?

Quote:
Originally Posted by Miikka View Post
Sudoers file is located in /etc/sudoers. It should have examples inside of what you need to add.

I do not have an /etc/sudoers file, I have an /etc/sudoers.d file and when I open it it says that it can not open the file. What do I do?
__________________
I do not know why I left Fedora for Ubuntu, please I ask of you to forgive me O Blessed One, I shall never betray you again...
[SIGPIC][/SIGPIC]
Reply With Quote
  #4  
Old 18th April 2011, 08:08 PM
blackplague1347's Avatar
blackplague1347 Offline
Registered User
 
Join Date: Nov 2010
Age: 25
Posts: 55
linuxfirefox
Re: Add user to Sudoers File?

Quote:
Originally Posted by AgentTeddie View Post
How do I add myself to the Sudoers File? When I go to use the "Sudo" command, it tells me I am not in the Sudoers File, so I have to do "su -" to bypass it for the time being. How do I add myself? Thanks
David
Run:
Code:
 su -c visudo
Enter your password then scroll down to the line that says:
Code:
## Allow root to run any commands anywhere
root            ALL=(ALL)       ALL
Add the following line directly after the above, where "username" is your user name:
Code:
username          ALL=(ALL)      ALL
Scroll down to the following line
Code:
## Allows people in group wheel to run all commands
# %wheel ALL=(ALL)       ALL
Remove the # in front of the second line

That's how I did it, anyway. I actually didn't need to the last part for it to work, so I'm not sure what it does. It's just how I learned to do it when I first got started.
Reply With Quote
  #5  
Old 18th April 2011, 08:09 PM
magicalshashank Offline
Registered User
 
Join Date: Apr 2011
Posts: 14
linuxfedorafirefox
Re: Add user to Sudoers File?

use
Code:
su
passwrd
#visudo
it will open the file /etc/sudoers
then
copy the line with yy command
root ALL=(ALL) ALL
and rename it to
"username u want to add" ALL=(ALL) ALL
save the file
now u r in sudo
Reply With Quote
  #6  
Old 18th April 2011, 08:12 PM
FuzzyDoom Offline
Registered User
 
Join Date: Nov 2010
Location: Oklahoma
Age: 19
Posts: 62
linuxchrome
Re: Add user to Sudoers File?

FedoraPlus does it for you too.

FedoraPlus
__________________
Computer Spec:
AMD 3.0 GHz Quad Core
4 GB DDR3 RAM
320 GB Samsung HDD
GIGABYTE Motherboard
Nvidia GT 430
Crappy Old Dell 15" CRT Monitor
Fedora 15 64 Bit
Reply With Quote
  #7  
Old 18th April 2011, 08:34 PM
AgentTeddie's Avatar
AgentTeddie Offline
Registered User
 
Join Date: Mar 2011
Location: Cincinnati, Ohio
Age: 23
Posts: 99
linuxfedorafirefox
Re: Add user to Sudoers File?

Quote:
Originally Posted by blackplague1347 View Post
Run:
Code:
 su -c visudo
Enter your password then scroll down to the line that says:
Code:
## Allow root to run any commands anywhere
root            ALL=(ALL)       ALL
Add the following line directly after the above, where "username" is your user name:
Code:
username          ALL=(ALL)      ALL
Scroll down to the following line
Code:
## Allows people in group wheel to run all commands
# %wheel ALL=(ALL)       ALL
Remove the # in front of the second line

That's how I did it, anyway. I actually didn't need to the last part for it to work, so I'm not sure what it does. It's just how I learned to do it when I first got started.
I did this but how do I save it? I cannot figure out how to get out of it?
__________________
I do not know why I left Fedora for Ubuntu, please I ask of you to forgive me O Blessed One, I shall never betray you again...
[SIGPIC][/SIGPIC]
Reply With Quote
  #8  
Old 18th April 2011, 08:38 PM
blackplague1347's Avatar
blackplague1347 Offline
Registered User
 
Join Date: Nov 2010
Age: 25
Posts: 55
linuxfirefox
Re: Add user to Sudoers File?

Quote:
Originally Posted by AgentTeddie View Post
I did this but how do I save it? I cannot figure out how to get out of it?
You can save and exit the file by pressing "esc" to get into command mode (after making the necessary changes to the file) and then type ":wq" which Writes to disk and Quits.
Reply With Quote
  #9  
Old 18th April 2011, 09:09 PM
AgentTeddie's Avatar
AgentTeddie Offline
Registered User
 
Join Date: Mar 2011
Location: Cincinnati, Ohio
Age: 23
Posts: 99
linuxfedorafirefox
Re: Add user to Sudoers File?

Quote:
Originally Posted by blackplague1347 View Post
You can save and exit the file by pressing "esc" to get into command mode (after making the necessary changes to the file) and then type ":wq" which Writes to disk and Quits.
That for me does not work, I hit ESC and it does nothing...

---------- Post added at 04:06 PM ---------- Previous post was at 03:47 PM ----------

SO how do I save because when I hit ESC nothing happens, it will not let me type?

---------- Post added at 04:09 PM ---------- Previous post was at 04:06 PM ----------

Nevermind I found out how a much easier way! Thanks for the help though!
__________________
I do not know why I left Fedora for Ubuntu, please I ask of you to forgive me O Blessed One, I shall never betray you again...
[SIGPIC][/SIGPIC]
Reply With Quote
  #10  
Old 18th April 2011, 09:17 PM
Miikka's Avatar
Miikka Offline
Registered User
 
Join Date: Apr 2011
Location: Finland
Posts: 293
linuxfedorafirefox
Re: Add user to Sudoers File?

Quote:
Originally Posted by AgentTeddie View Post
Nevermind I found out how a much easier way! Thanks for the help though!
Please share your knowledge so people who are having same problems and have found this thread can solve their problems as well.
Reply With Quote
  #11  
Old 18th April 2011, 09:24 PM
glennzo's Avatar
glennzo Online
Un-Retired Administrator
 
Join Date: Mar 2004
Location: Salem, Mass USA
Posts: 13,933
windows_xp_2003firefox
Re: Add user to Sudoers File?

As root type echo 'username ALL=(ALL) ALL' >> /etc/sudoers. Obviously substitute username for your username
__________________
Glenn
The Bassinator © ®


Laptop: Toshiba Satellite / Intel Core 2 Duo 1.73 GHz / 2GB / 160GB / Intel Mobile 945GM/GMS/GME/943/940GML Integrated Graphics
Desktop: BioStar MCP6PB M2+ / AMD Phenom 9750 Quad Core / 4GB / 1TB SATA / 500GB SATA / EVGA GeForce 8400 GS 1GB
Reply With Quote
  #12  
Old 18th April 2011, 09:26 PM
AgentTeddie's Avatar
AgentTeddie Offline
Registered User
 
Join Date: Mar 2011
Location: Cincinnati, Ohio
Age: 23
Posts: 99
linuxfedorafirefox
Re: Add user to Sudoers File?

This website is what helped me!

http://www.mjmwired.net/resources/mj...-fc6.html#sudo

---------- Post added at 04:26 PM ---------- Previous post was at 04:25 PM ----------

Quote:
Originally Posted by glennzo View Post
As root type echo 'username ALL=(ALL) ALL' >> /etc/sudoers. Obviously substitute username for your username
That is what I did to do it!
__________________
I do not know why I left Fedora for Ubuntu, please I ask of you to forgive me O Blessed One, I shall never betray you again...
[SIGPIC][/SIGPIC]
Reply With Quote
  #13  
Old 18th April 2011, 09:30 PM
bodhi.zazen's Avatar
bodhi.zazen Offline
Registered User
 
Join Date: Jul 2006
Location: Montana
Posts: 731
unknownunknown
Re: Add user to Sudoers File?

Quote:
Originally Posted by Miikka View Post
Please share your knowledge so people who are having same problems and have found this thread can solve their problems as well.
"easy" method is to use an alternate editor.

visudo is preferred as it (visudo) checks for syntax errors. Not as critical on Fedora as on Ubuntu as the root account is not locked.

1. become root

Code:
su -
2. Set your editor

Code:
export EDITOR=nano
If you do not like nano, use another tool, gedit, kate, leafpad, etc.

3. Edit away

Code:
visudo
Also, FYI, when editing your sudoers file, keep in mind the "last match" for your user (often) takes precidence.

So, I would advise you use:

Quote:
username ALL=(ALL) ALL
on a single user system, or

Quote:
%wheel ALL=(ALL) ALL
on a multi user system where you want to grant root privileges to a group of users, but not both.

See also: http://www.gratisoft.us/sudo/sudoers.man.html
__________________
If it is not broken, tweak it... If you break Fedora you get to keep both pieces :p
Reply With Quote
  #14  
Old 17th June 2012, 03:36 AM
Willard McJimbe Offline
Registered User
 
Join Date: Jun 2012
Location: San Diego, CA
Posts: 3
linuxcroschrome
Re: Add user to Sudoers File?

Quote:
Originally Posted by glennzo View Post
As root type echo 'username ALL=(ALL) ALL' >> /etc/sudoers. Obviously substitute username for your username
PLEASE NOTE: this command no longer works, at least not on a clean install of FC 17. It *did* work using the live disc, which is odd. But on an install, nope.

The notes in the sudoers file read:
This file must be edited with the 'visudo' command.
This means echo doesn't work, and you can't open sudoers with gedit. Apparently visudo checks the syntax of any changes before saving, and won't allow you to save if it's wrong.

So scratch that old trick off your list. It's been deprecated. Now, all you have to do to add your user name to /etc/sudoers is...

-switch to root
-run visudo
-figure out how the hell to use visudo, which is as easy as learning to use vi

Easy!

Last edited by Willard McJimbe; 17th June 2012 at 03:37 AM. Reason: clarification
Reply With Quote
  #15  
Old 17th June 2012, 01:12 PM
smr54 Online
Registered User
 
Join Date: Jan 2010
Posts: 4,979
linuxchrome
Re: Add user to Sudoers File?

visudo uses the default editor--for example, on Ubuntu, I think it will open with nano.

If you prefer nano you could probably use
Code:
su 
EDITOR=nano
visudo
Reply With Quote
Reply

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 a user to sudoers file ajamison Using Fedora 34 8th May 2011 12:05 AM
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
Sudoers File? Tutious Using Fedora 1 24th April 2008 04:00 AM
not in the sudoers file frankje Using Fedora 4 19th April 2007 01:37 AM


Current GMT-time: 17:47 (Friday, 24-05-2013)

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