• 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. Managing network resources in Solaris 11 using “dlstat” and “flowstat”
  2. Beginners guide to Oracle Solaris Live Upgrade
  3. How to Check Solaris Release and Default Kernel Version
  4. Complete Hardware Reference : SPARC T5-2 / T5-4 / T5-8
  5. Solaris : How to enable ssh login for root user after a fresh install
  6. Solaris ZFS : How to import 2 pools that have the same names
  7. Solaris 10 patching with SVM : Traditional method (non-live upgrade)
  8. Solaris 11 : How to verify whether I’m logged into a Kernel Zone?
  9. Examples of adding static routes in Solaris
  10. How to configure rsyslog on Solaris 11.1 to send messages to a remote host using TCP

You May Also Like

Primary Sidebar

Recent Posts

  • powertop Command Examples in Linux
  • powertop: command not found
  • powerstat: command not found
  • powerstat Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright