How to allow users in a group to run all commands in Fedora / CentOS using sudo

This tutorial will guide you on how to allow a group of users to run all the commands without sharing your system root password in Fedora / Redhat / CentOS based Distros.

This is similar to the sudo in Ubuntu. Here we will start by creating a group called "sysadmin", then we will append a user "chia" to that group which will be able to run any command on the system. Lets start by creating a group and adding a user to it.

[root]# groupadd sysadmin

[root]# usermod -aG sysadmin chia

Now edit the /etc/sudoers. Its possible to edit the file in an editor, but its safer to use visudo instead.

[root]# visudo

Add the following line to the file

%sysadmin  ALL=(ALL) ALL

Now you can login as user "chia" and run any command by appending sudo.

[chia]$ sudo ifconfig

You can also gain access to root shell by using password of user "chia"

[chia]$ sudo -s

[sudo] password for chia: <chia's password>

[root]#

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <img> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <h1> <h2> <h3> <h4> <h5> <h6> <p> <br>
  • Image links with 'rel="lightbox"' in the <a> tag will appear in a Lightbox when clicked on.
  • Search Engines will index and follow ONLY links to allowed domains.

More information about formatting options

Mollom CAPTCHA (play audio CAPTCHA)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.