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/solaris/installing-sudo-on-solaris/ .
© 2012.

14 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,

  • cherry says:

    Hi

    I mentioned same path in the /etc/profile as root.Even though its not executing with out full path of sudo command like /usr/local/bin/sudo.

    even i mentioned a path like below in /etc/profile file.

    export PATH=$PATH:/usr/local/bin

    and saved it.But now also its not working with out full path of sudo command.

    Sorry if i am disturbing you.

    • Hendrawan says:

      No problem cherry, mmm..maybe you can create soft link for this, "ln -s /usr/local/bin/sudo /usr/bin/sudo".
      let me if its not working

  • cherry says:

    Hi,

    Now sudo works good.I mentioned the path(/usr/local/bin) in the users .bash_profile file.Then onwards its working good with out full path(/usr/local/bin/sudo) of the sudo.

    can i contact you if any issues come other than sudo through this site?

    Thanks for your valuble help.

    • Hendrawan says:

      @cherry
      sound good..but don't remove sudo path in your /etc/profile, it effect when your created new user, so you don't bother to added sudo path in every new user had you created.
      yes, don't hesitate to contact me.

  • Partha says:

    Hi, I followed the same but getting an error saying wget not found after running this command-wget ftp://ftp.sudo.ws/pub/sudo/sudo-1.7.0.tar.gz, i have already installed wget.

    Please help

RSS feed for comments on this post

Leave a Reply