Search code examples
configurationsolarissudosolaris-10

Solaris 10 sudo configuration Issue


I am using SunOS 5.10 Generic_147441-24 i86pc i386 i86pc

if i run

which sudo

i get the below

/opt/sfw/bin

when i run "sudo -l" i get the below

User localuser may run the following commands on this host:

(root) NOPASSWD: /sbin/ifconfig

for "visudo"

visudo

-bash: visudo: command not found

also /etc/sudoers file does not exist in the box.

Please help me configure sudo, how it is possible with out the sudoers file.


Solution

  • I've never seen the sudo binary exist in /opt, so my first thought would be that your visudo binary is not in your path, or the sudo package you installed does not contain the visudo binary. Either way you may consider downloading the sudo package again and reinstalling.

    To see if your visudo binary exists anywhere:

    find / -name visudo -print
    

    If you find nothing, remember you do not explicitly need visudo to use sudo -- it's there as a checkpoint for making sure that you do not save and exit a sudoers file that has errors, thus possibly compromising your ability to edit it again or to break sudo for all users on the host.

    Also note that /etc/sudoers can start off empty, just fill it in with your sudo rules. For example, to provide sudo all commands on that host for a user without prompting for a password:

    userid ALL=(ALL) NOPASSWD: ALL
    

    That particular user ID can run "sudo -l" to list the sudo rules available to it. You could do this even just to test that sudo is in fact working on your host.