Category: SUDO

SUDO extra functionality in /etc/sudoers.d/

Say our username is mike and our host is alpha To add specific commands (say /bin/binary1 and /bin/binary2) that we would be able to run through sudo without a password, we can do the following: Run sudo visudo -f /etc/sudoers.d/mike and add the following to it: mike alpha=(root:root) NOPASSWD: /bin/binary1,/bin/binary2

SUDO installation and configuration

Install the sudo package using your system’s package manager (Gdebi, synaptic, aptitude, apt-get, yum, rpm, or whichever package manager is available on your system) In a terminal (which we’ll refer to as root terminal from now on), run su to log in as root, and then run: egrep -e ‘sudo|wheel’ /etc/group to determine if group sudo or wheel (or even both) exist on your system If the output is like: sudo:x:27: we can go ahead and add ourselves to it by running in the root terminal: usermod -a -G sudo your_username In the root terminal run visudo and locate the %sudo or %wheel references and make sure that the one that refers to the group you’ve added yourself to is uncommented, e.g. %sudo ALL=(ALL:ALL) ALL Log out of your desktop manager and log back in to activate the group membership you have just added yourself to. In a normal terminal, run sudo su – root and put your own password once asked. If all has gone to plan you should be presented with the root prompt. In another terminal, run gksu-properties and select sudo for Authentication mode and ensure Grab mode is set to enabled and press Close