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.
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.
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
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.
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.
“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.
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
visudo
edits thesudoers
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
orless /etc/sudoers
is sufficient. (You'll need root privileges for any of these, sosudo cat /etc/sudoers
, for example.) – Keith Thompson Sep 12 '14 at 20:50