©2015 - 2022 Chad’s Technoworks. Disclaimer and Terms of Use

Chad’s TechnoWorks My Journal On Technology

HOW TO CONFIGURE SUDO IN SOLARIS


DOWNLOAD THE REQUIRED PACKAGES


Go to the Sun Freeware website to download the following packages for your platform. In my case, the packages are for the Solaris 10 x86.


NOTE: You may download my local copies of the packages below. For browsers other than Internet Explorer or Safari, do right-click at the link and select “Save As..” to download the files.


libgcc-3.4.6-sol10-x86-local.gz

libiconv-1.9.2-sol10-x86-local.gz

libintl-3.4.0-sol10-x86-local.gz

sudo-1.8.3p2-sol10-x86-local.gz



INSTALL THE LIBRARIES AND SUDO PACKAGES


NOTE: Respond with "y" to all pkgadd prompts


# gunzip libiconv-1.9.2-sol10-x86-local.gz

# pkgadd -d libiconv-1.9.2-sol10-x86-local

# pkginfo SMCliconv

application SMCliconv libiconv

#


# gunzip libgcc-3.4.6-sol10-x86-local.gz

# pkgadd -d libgcc-3.4.6-sol10-x86-local

# pkginfo SMClgcc346

application SMClgcc346 libgcc

#


# gunzip libintl-3.4.0-sol10-x86-local.gz

# pkgadd -d libintl-3.4.0-sol10-x86-local

# pkginfo SMClintl

application SMClintl libintl


# gunzip sudo-1.8.3p2-sol10-x86-local.gz

# pkgadd -d sudo-1.8.3p2-sol10-x86-local

# pkginfo SMCsudo

application SMCsudo sudo


CREATE SYMBOLIC LINKS


# ln -s /usr/local/etc/sudoers /etc/sudoers

# ln -s /usr/local/bin/sudo /bin/sudo

# ln -s /usr/local/bin/sudoedit /bin/sudoedit


MAKE sudoers FILE WRITABLE TO ROOT BEFORE EDIT

# ls -l /usr/local/etc/sudoers

-r--r-----   1 root     root        2869 Feb  9  2012 /usr/local/etc/sudoers

#

# chmod u+w /usr/local/etc/sudoers

# ls -l /usr/local/etc/sudoers

-rw-r-----   1 root     root        2869 Feb  9  2012 /usr/local/etc/sudoers

#


EDIT SUDOERS FILE TO PROCEED WITH ADDING PRIVILEGES TO USERS

A good reference for sample parameters of sudoer file can be found here.

The example below is to allow the users - jkirk, jbourne - to switch to a no login account of user oradb.


vi /usr/local/etc/sudoers


# Add entries below

User_Alias DBAUSERS = jkirk, jbourne

DBAUSERS   ALL=NOPASSWD: /usr/bin/su - oradb, /sbin/su - oradb, /*/app/oraInventory/orainstRoot.sh, /*/app/*/product/*/db/root.sh


MAKE SUDOERS FILE BACK TO READ 0440 PERMISSIONS

#chmod 0440 /usr/local/etc/sudoers

# ls -l /usr/local/etc/sudoers

-r--r-----   1 root     root        2925 Mar 20 14:48 /usr/local/etc/sudoers

#


If don't do the above 0440 change, sudo will not work and give error as:

-bash-3.2$ sudo su - oradb

sudo: /usr/local/etc/sudoers is mode 0660, should be 0440

sudo: no valid sudoers sources found, quitting

sudo: unable to initialize policy plugin

-bash-3.2$


TO CHECK CURRENT SUDO PRIVILEGES


-bash-3.2$  sudo -l




Information Technology