• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to install and configure sudo in solaris 10 (SPARC and x86/x64)

by admin

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 /etc/sudoers configuration file to have temporary access to run commands they would not normally note be able to. The commands can be run as user “root” or as any other user, as defined in the /etc/sudoers file. The privileged command that needs to be run must first begin with the word sudo followed by the command’s regular syntax. The user may prompted for the password depending on the configuration. Once authenticated, the necessary command can be executed depending on whether the /etc/sudoers configuration file permits the same. It also provides an audit trail of the commands and their arguments.

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: 16920595 (for x86) and 16920591 (for SPARC).

install and configure sudo in solaris

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

Configuring sudo

The /etc/sudoers file contains all the configuration details. The file can only be edited by the root user. When editing this file, use the command: visudo with no arguments. The visudo command mimics the vi editor to edit the /etc/sudoers configuration file. It is recommended that only this command be used to modify the sudoers file, as this file may not be located in the same directory on all systems. Also, this will prevents two users from editing the file at the same time and provides limited syntax checking.

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.

Filed Under: Solaris

Some more articles you might also be interested in …

  1. How to Collect a Forced Crash Dump of a Hanging Solaris Guest LDom
  2. Complete Hardware Reference : SPARC T7-1 / T7-2 / T7-4
  3. Solaris Interview Questions – Inodes and the Filesystem Troubleshooting
  4. The ultimate Solaris Volume Manager (SVM) interview questions
  5. How to Configure Integrated Load Balancer (ILB) in Solaris 11
  6. How to send mails with attachments using the solaris mailx command
  7. What are Oracle Solaris 11 Installation Methods
  8. Determining which network interface will be used for jumpstart installation / network boot
  9. How to dynamically replace CPU/memory board (dynamic reconfiguration) on SunFire s6800/e12K/e15K/e25K
  10. How to set up cron for automatic data collection from the system activity reporter (SAR) in Solaris 10 and 11

You May Also Like

Primary Sidebar

Recent Posts

  • vgextend Command Examples in Linux
  • setpci command – configure PCI device
  • db_load command – generate db database
  • bsdtar command – Read and write tape archive files

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright