Sudo (super user do) command is a program for Unix / Linux Operating Systems that allows users to run programs with the security privileges of another user (can be the superuser i.e root or any other user in the system).
The sudo utility allows users defined in the
How to download the sudo package
You can find the package by doing a patch search in “patches & updates” section on support.oracle.com. select the platform as “Oracle Solaris on SPARC” or “Oracle Solaris on x86” and download the patches:
The sudo utility is composed of the following three packages:
SUNWsudor contains configuration files, which are installed in /etc directory.
SUNWsudou contains sudo binaries and documentation.
SUNWsudoS contains source code of sudo.
Installing sudo packages
The following procedure uses SPARC platform as an example but the steps remain the same for x86 platform as well. Once you have downloaded the 3 packages from my oracle support site, place them in a temporary location. extract the packages :
# cd /tmp # gunzip sudo-1.0-sudo.sparc.tar.gz # tar xf sudo-1.0-sudo.sparc.tar
Install the packages in the order given below :
# pkgadd -d . SUNWsudor # pkgadd -d . SUNWsudou # pkgadd -d . SUNWsudoS
Some of the most commonly used examples to understand how and which privileges can be configured via sudo are listed below.
Example 1 : run specific commands/script
The below command gives the user ‘oracle’ the privilege to run the script root.sh without the need to specify the password (NOPASSWD).
# visudo oracle ALL = NOPASSWD: /u01/app/oracle/product/10.2/root.sh
Example 2 : run all commands
To allow the uses to run all the commands without prompting for a password :
# visudo username ALL=(ALL) NOPASSWD: ALL
Example 3 : Always ask for password to run all commands
# visudo ALL ALL=(ALL) ALL
You can also define user/group aliases in the sudoers file. The /etc/sudoers file lists out many examples with explanations.