Installing Sudo On Solaris (*update)

Sudo (su "do") allows a system administrator to give certain users (or groups of users) the ability to run some (or all) commands as root while logging all commands and arguments
Sudo is supplied in source form and you need to compile it.
This isn't difficult! Before doing so, you need to have installed the g(un)zip program and a C compiler.

Installing sudo

Prefare the source download it from http://www.courtesan.com/sudo/download.html,

bash> uname -sr
SunOS  5.9
bash> wget ftp://ftp.sudo.ws/pub/sudo/sudo-1.6.9p5.tar.gz
bash> gunzip -dc sudo-1.6.9p56.tar.gz |tar xvf -
bash> cd sudo-1.6.9p5
bash> ./configure
bash> ./make
bash> ./make install

Add environment Parameter ( added in .profile User$)

bash> export PATH=$PATH:/usr/local/bin:/usr/local/sbin:/usr/ccs/bin
bash> export MANPATH=$MANPATH:/usr/man/:/usr/local/man

Added Sudoers

bash> visudo

find
# User privilege specification
root ALL=(ALL) ALL

Add user id to make him power like root

hendra  ALL=(ALL) NOPASSWD:ALL

The power of root

bash> sudo vi /etc/passwd

UPDATE
This post was old, so I will update and try on my Solaris 10 x86.
so enjoy this technically tutor.

First install your compiler, make, wget and don't forget with the dependencies, grab your packet from http://sunfreeware.com

uname -sr
SunOS 5.10
bash> gunzip libiconv-1.11-sol10-x86-local.gz 
bash> gunzip db-4.2.52.NC-sol10-intel-local.gz 
bash> gunzip gcc-3.4.6-sol10-x86-local.gz 
bash> gunzip libgcc-3.4.6-sol10-x86-local.gz 
bash> gunzip make-3.81-sol10-x86-local.gz 
bash> gunzip wget-1.11.4-sol10-x86-local.gz
bash> pkgadd -d libiconv-1.11-sol10-x86-local 
bash> pkgadd -d db-4.2.52.NC-sol10-intel-local 
bash> pkgadd -d libgcc-3.4.6-sol10-x86-local 
bash> pkgadd -d libgcc-3.4.6-sol10-x86-local 
bash> pkgadd -d make-3.81-sol10-x86-local 
bash> pkgadd -d wget-1.11.4-sol10-x86-local

Now install the sudo

bash> export PATH=$PATH:/usr/local/bin:/usr/local/sbin
bash> wget ftp://ftp.sudo.ws/pub/sudo/sudo-1.7.0.tar.gz
bash> gunzip sudo-1.7.0.tar.gz 
bash> tar -xvf sudo-1.7.0.tar 
bash> cd sudo-1.7.0
bash> ./configure 
bash> make
bash> make install

Last try to add anything user as you like

bash> visudo

and find code like here..
# User privilege specification
root ALL=(ALL) ALL

then add user id to make him power like root

hendra  ALL=(ALL) NOPASSWD:ALL

The power of root (part 2)

bash> id
uid=100(hendra) gid=101(jagoan)
bash> export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin
bash> sudo useradd -d /dev/null -s /bin/false tes

Done.

Printed from: http://sysinfo.bascomp.org/2007/09/installing-sudo-on-solaris/ .
© 2010.

11 Comments   »

  • verboze says:

    worked like a charm, Thanks!

  • Hendrawan says:

    Enjoy the magic show here..
    thanks for feedback verboze

  • alex says:

    I following your steps, but I am getting
    bash-3.00# ./make
    bash: ./make: No such file or directory

    Pls, help

  • Hendrawan says:

    Hi alex,
    do you have "make" install on your solaris box.
    if not, you can grab from here http://sunfreeware.com

  • cherry says:

    Hi,
    i tried this.it works good.But when user logs out and again login he is not assigning the sudo features.Every time whenever user login,he has to set the path like what u have mentioned above
    # export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin

    then only user can access the root previlleges using sudo.Pls help to me get out of this.Thanks for the code.

    Regards
    cherry

  • Hendrawan says:

    cherry:
    put "export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin" in your profile (.profile), or user who added in sudo user.

  • cherry says:

    Hi hendra,

    Thanks for your valuble suggestion.I set the same path like what u mentiond above like this

    "export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin" in users .profile file.Now its executing when ever user logout and login.

    But here is new issue like its not accepting the command when i try to give command like this.

    # sudo mv
    output: command not found

    Now i execute the command like this

    #/usr/local/bin/sudo mv

    when i execute this command then only its working.
    we can not give the complete command every time like this.
    pls suggest me.

  • cherry says:

    Hi hendra,

    Thanks for your valuble suggestion.I set the same path like what u mentiond above like this

    "export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin" in users .profile file.Now its executing when ever user logout and login.

    But here is new issue like its not accepting the command when i try to give command like this.

    # sudo mv
    output: command not found

    Now i execute the command like this

    #/usr/local/bin/sudo mv

    when i execute this command then only its working.
    we can not give the complete path of command every time like /usr/local/bin/sudo.
    pls suggest me.

  • Hendrawan says:

    cherry:
    actually when you mention some path in your environment it's usually working and we doesn't give full path in every command. If you not clearly understood better you used soft link.

    # sudo mv
    output: command not found

    please add "export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin" in all users in your system, even root, or you can add those path in your "/etc/profile".

    Sorry for late reply,

RSS feed for comments on this post

Leave a Reply