Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

share|improve this question
1  
@tshepang your sudo questions have nothing to do with fedora, I've removed the tags you might want to consider modifying the text. –  xenoterracide Nov 30 '10 at 2:18
1  
as stated, this question is a mere duplicate of 3063. –  NixNinja Nov 30 '10 at 7:37
    
@Stefan, 3063 asks "how to run as admin". My question is "how to make a user be a sudoer". –  Tshepang Nov 30 '10 at 10:08
    
@xeno There's differences on Fedora's sudo and Debian's (and Ubuntu's). On Debian, installing sudo also creates a group for it, but that's not the case for Fedora. So no, this question is valid. –  Tshepang Nov 30 '10 at 10:12
1  
I read the supposed duplicate question unix.stackexchange.com/questions/3063/… . IMO this is not a duplicate. –  Trevor Boyd Smith Sep 15 '11 at 17:35
show 4 more comments

3 Answers

up vote 21 down vote accepted

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.

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.

share|improve this answer
add comment

I suppose that the first question is, do you have sudo installed on the server(s) in question? Assuming so, it is just a matter of deciding whether you want to treat the user as a unique entity or as part of a group, a group which may have only 1 member. The command visudo as root will give you access to edit the sudoers file, often /etc/sudoers.

the former:

user ALL= /foo/bar

the latter:

%group  ALL= /foo/bar

These are merely two examples, the sudo package has a tremendous number of features and settings options at your disposal. I recommend reading the sudoers, sudo's configuration file, manual. I would also recommend starting simple and building up to the actual desired configuration.

share|improve this answer
    
Actually, all I want is to be able to do simple admin stuff like sudo yum install blah. –  Tshepang Nov 29 '10 at 16:52
    
Depending on the size of the set of "simple admin stuff" it may be more convenient to leverage sudo's aliasing to establish a list of allowed commands and provide privilege escalation to the list rather than to enumerate each with its own configuration. –  Tok Nov 29 '10 at 16:57
    
Not sure what you mean. I just wanted something as simple as adding user ALL=(ALL) ALL, without breaking the brain with the myriad sudo options? I ask because in Debian the recommended way is to add user to sudo group, so I wanted to know what it was in Fedora. –  Tshepang Nov 29 '10 at 17:16
    
That syntax will work for Fedora as well, however, I would not recommend granting unrestricted sudo access to all commands as a general rule. –  Tok Nov 29 '10 at 17:34
    
@Tshepang - I missed the second part of your earlier question. I believe that Fedora will allow you to specify a user by name in the sudoers file without adding them to any group in particular. Have you experienced one or more problems with this approach? –  Tok Nov 30 '10 at 13:24
show 1 more comment

Just run this command:

su -c " usermod -g wheel username"
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.