Professional Documents
Culture Documents
How To Add A User To Sudoers File
How To Add A User To Sudoers File
cd rtl8821ce
sudo ./dkms-install.sh
$ su -
# cat /etc/suders.d/020_my_sudo
=======================================================================
===To enable sudo for your user ID on RHEL, add your user ID to the wheel group:===
Now you will be able to use sudo when logged in under your normal user ID. You will be asked to
enter the password for your user ID when you run a sudo command. For the next five minutes, sudo
will remember that you’ve been authenticated, so you won’t be asked for your password again.
This works because the default /etc/sudoers file on RHEL contains the following line:
That line enables all users in group wheel to run any command with sudo, but users will be asked to
prove their identity with their password. Note: there is no comment symbol (#) in front of that line.
After logging out and back in again, you can verify that you are in group wheel by running the id
command:
$ id
=======================================================================
You can also configure sudo to not ask for a password to verify your identity. For many situations
(such as for real servers) this would be considered too much of a security risk. However, for
developers running a RHEL VM on their laptop, this is a reasonable thing to do since access to their
laptops is probably already protected by a password.
To set this up, two different methods are shown. You can either edit /etc/sudoers or you can create
a new file in /etc/sudoers.d/. The first is more straightforward, but the latter is easier to script and
automate.
Edit /etc/sudoers
As root, run visudo to edit /etc/sudoers and make the following changes. The advantage of using
visudo is that it will validate the changes to the file.
The default /etc/sudoers file contains two lines for group wheel; the NOPASSWD: line is commented
out. Uncomment that line and comment out the wheel line without NOPASSWD. When you are
done, it should look like this: