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 am looking for the name of the superusers list on Fedora. (On Ubuntu is seems to be "sudo".) I want to add one of the users to the superusers list.

The groups command only lists the groups of the current user.

share|improve this question

5 Answers 5

up vote 3 down vote accepted

There is only one superuser on Fedora and i.e. root. If you are looking for other user's who have the sudo privilege then you can look into /etc/sudoers file by executing command

visudo

Here you can add any user to have the sudo privilege, by adding the following line at the end of the /etc/sudoers file:

loginname ALL=(ALL) ALL
share|improve this answer
    
Thanks. I found out the format of the line that has to be added and edited your answer. –  Geoffrey Jun 29 '12 at 7:26
    
But unless you have a special use case, don't do that. Do this. –  mattdm Jun 29 '12 at 22:58
    
(Speaking as myself, not as a moderator.) –  mattdm Jun 29 '12 at 22:59
    
visudo edits the sudoers file; use it only if you want to modify it (yes, that's what the OP indirectly asked about). If you just want to view it, cat /etc/sudoers or less /etc/sudoers is sufficient. (You'll need root privileges for any of these, so sudo cat /etc/sudoers, for example.) –  Keith Thompson Sep 12 at 20:50

“Superusers”, as in the users who can obtain administrative privileges, are the users who either know the root password or are authorized to execute commands as root with a mechanism such as sudo. These days, sudo is the most common and generally recommended mechanism.

There is no general rule to tell which users are allowed to gain privileges with sudo, it is a matter of convention. Look in the file /etc/sudoers for a line like

%sudo ALL = ALL

This means “Users in the group called sudo are allowed to run any command as any user”. Sometimes you'll see (ALL) after the equal sign: it's an optional way to restrict the line to work only on a particular machine (if you put a host name instead of ALL), which allows deploying the same configuration file to multiple machines with different intended privileges.

If there is such a line, you can add users to the sudo group:

adduser bob sudo

You can review who is a member of the sudo group by listing the group database:

getent group sudo

If there is no %sudo (or %admin or %wheel, as I said before the name is a matter of convention, and there can be more than one such entry), you can create one with addgroup and add the line to the sudoers file (use visudo to edit that file). Alternatively, instead of creating a group, you can add individual entries to the sudoers file (again, use visudo to edit this file):

bob ALL = ALL

Using a group makes management a little easier because you can see at a glance who is a member of this group.

share|improve this answer

To add a user to a group, such as wheel your can use the vigr command. You will also need to use vigr -s to update the shadow file.

share|improve this answer
    
I don't believe that is what the OP is asking. The question is how to find out what users have UID 0, or are in the group with sudo privileges. –  uther Jun 29 '12 at 17:18
    
At the end of the first paragraph he says "I want to add one of the users to the superusers list." If he adds the user to the groups a current super user is in using vigr and vigr -s he won't have to touch sudo as it will read the grorups file. This will handle other things the default superuser can do without resorting to sudo. –  Phillip Nordwall Jul 2 '12 at 14:14

It is perfectly well possible to have more than one user with root privileges, it is uncommon to create them though. You can create a user and assign it UID 0, just make sure the first line in /etc/passwd is always for root. For most users it is bad practice to do this though.

To list all users with root privileges:

grep -E '^[^:]*:[^:]*:0:' /etc/passwd
share|improve this answer
    
Technically, these aren't users with the same UID, but multiple entries for the same user in the group database. And this is pretty clearly not what the asker was asking about. Multiple entries for root do have their uses occasionally, but giving admin privileges to users is most emphatically not it. –  Gilles Jun 30 '12 at 14:46

To list all available groups with users in them you can use

getent group

or just look the content of /etc/group file.

By the way, on ubuntu there is only one superuser too. It is root. All others just are allowed to use it privilleges via sudo. You can modify rules in /etc/sudoers via visudo as mentioned above, if sudo is installed. This is true for any main stream GNU/Linux distro.

share|improve this answer

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.