Add User to Sudoers on CentOS Rumi, March 21, 2023March 21, 2023 You can do this in 2 methods- however, IMHO method-2 usually works great for me. Method-1 Step 1: Verify the Wheel Group is Enabled Your CentOS 7 installation may or may not have the wheel group enabled. Open the configuration file by entering the command: visudo Scroll through the configuration file until you see the following entry: ## Allows people in group wheel to run all commands # %wheel ALL=(ALL) ALL If the second line begins with the # sign, it has been disabled and marked as a comment. Just delete the # sign at the beginning of the second line so it looks like the following: %wheel ALL=(ALL) ALL Then save the file and exit the editor. Note: If this line didn’t start with a # sign, you don’t need to make any changes. The wheel group is already enabled, and you can close the editor. Step 2: Add User to Group To add a user to the wheel group, use the command: usermod –aG wheel UserName As usual, replace UserName with the name of the user receiving sudo privileges. Step: 3 Switch to the Sudo User Switch to the new (or newly-elevated) user account with the su (substitute user) command: su - UserName Enter the password if prompted. The terminal prompt should change to include the UserName. Enter the following command to list the contents of the /root directory: sudo ls -la /root The terminal should request the password for UserName. Enter it, and you should see a display of the list of directories. Since listing the contents of /root requires sudo privileges, this works as a quick way to prove that UserName can use the sudo command. Method-2 Alternative: Add User to Sudoers Configuration File If there’s a problem with the wheel group, or administrative policy prevents you from creating or modifying groups, you can add a user directly to the sudoers configuration file to grant sudo privileges. Step 1: Open the Sudoers File in an Editor In the terminal, run the following command: nano /etc/sudoers Step 2: Add the New User to file Scroll down to find the following section: ## Allow root to run any commands anywhere root ALL=(ALL) ALL Right after this entry, add the following text: UserName ALL=(ALL) ALL Replace UserName with the username you created in Step 2. This section should look like the following: ## Allow root to run any commands anywhere root ALL=(ALL) ALL UserName ALL=(ALL) ALL Save the file and exit. Step 3: Test Sudo Privileges for the User Account Switch user accounts with the su (substitute user) command: su - UserName Enter the password for the account, if prompted. The terminal prompt should change to include UserName. List the contents of the /root directory: sudo ls - la /root Enter the password for this user when prompted. The terminal should display a list of all the directories in the /root directory. Src: https://phoenixnap.com/kb/how-to-create-add-sudo-user-centos Related Administrations Collected Articles CentOSSudosudoer
rec_control man section September 11, 2011September 11, 2011 Name rec_control – control pdns_recursor Synopsis rec_control [–help] [–socket-dir] [–socket-pid] command .. Description rec_control(1) allows the operator to control a running instance of the pdns_recursor. The commands that can be passed to the recursor are described on http://doc.powerdns.com/rec-control.html Examples To stop the recursor by hand, run: # rec_control quit To… Read More
Generate Large Test Files in Windows January 16, 2021 Open an administrative level command prompt. Run the following command: fsutil file createnew <file> <size in bytes> For example, this command will create a 1GB file called 1gb.test on my desktop: fsutil file createnew c:\users\steve\desktop\1gb.test 1073741824 The key is to input the size of the file in bytes so here… Read More
Install iRedmail on a CentOS 6.8 server March 17, 2018June 10, 2018 We need to set a FQDN hostname before we set up the mail server. On CentOS Linux, hostname is set in two files: Hostname setting: nano /etc/sysconfig/network # Part of file: /etc/sysconfig/network HOSTNAME=demo.iredmail.org Hostname <=> IP address mapping: /etc/hosts. WARNING: Please list the FQDN hostname as the first item. # Part of… Read More